Skip to content

Commit

Permalink
Remove broken Azure support; Fixed multiline commit message support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico de Groot committed Apr 1, 2023
1 parent 3129ab4 commit 1939d24
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

*GG* speeds up the creation of those pesky single commit merge requests by combining several (Git) commands into one.

It currently supports Github, Gitlab, Azure, and Bitbucket merge requests (or pull requests depending on the platform).
It currently supports Github, Gitlab, and Bitbucket merge requests (or pull requests depending on the platform).

Written example:

Expand Down Expand Up @@ -74,9 +74,7 @@ brew untap nicaso/gg

## To-do

There are still some things that could be created in the future.

- Supporting multiline commit messages.
Nothing I can think of for now. If you have any suggestions, please open an issue.

##### [Back to Contents](#contents)

Expand Down
19 changes: 12 additions & 7 deletions gg
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash

if [ $# -ne 2 ]; then
echo "Usage: gg <branch_name> <commit_message>"
if [ $# -ne 1 ] && [ $# -ne 2 ]; then
echo "Usage: gg <branch_name> <optional: commit_message>"
echo ""
echo "Example: gg feature/changing_purchase_button_color \"Making the purchase button red.\""
echo "Example with commit message included: gg feature/changing_purchase_button_color \"Making the purchase button red.\""
echo "Example with commit message via text editor: gg feature/changing_purchase_button_color"
exit 1
fi

Expand Down Expand Up @@ -34,14 +35,18 @@ if git checkout -b $1 2>&1 | grep -q "already exists"; then
exit 1
fi

# Currently GG supports 4 platforms: Github, Gitlab, Azure, and Bitbucket.
if [ "$2" ]; then
git commit -m "$2"
else
git commit
fi

# Currently GG supports 3 platforms: Github, Gitlab, and Bitbucket.
# They all use different paths for creating their merge requests.
# For Github it should match "pull/new"
# For Gitlab it should match "merge_requests/new"
# For Azure it should match "pullrequest"
# For Bitbucket it should match "pull-requests/new"

git commit -m "$2"
URL="$(git push origin HEAD 2>&1 | grep -Eo 'http.*((pull/new)|(merge_requests/new)|(pullrequest)|(pull-requests/new)).*')"
URL="$(git push origin HEAD 2>&1 | grep -Eo 'http.*((pull/new)|(merge_requests/new)|(pull-requests/new)).*')"
open $URL
git checkout $CURRENT_BRANCH

0 comments on commit 1939d24

Please sign in to comment.