Skip to content

Commit

Permalink
Added support for Github and Bitwarden.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicasso committed Mar 26, 2023
1 parent 3f3a1f3 commit fe83c72
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 26 deletions.
36 changes: 12 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# GG [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](LICENSE.md)

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

Written example:

Expand All @@ -10,7 +10,7 @@ Written example:

# Notice

It currently only works for Gitlab merge requests, an update will follow soon for GitHub support.
It currently only works for Github, Gitlab, and Bitbucket merge requests (or pull requests depending on the platform).

## Contents

Expand All @@ -19,9 +19,8 @@ It currently only works for Gitlab merge requests, an update will follow soon fo
3. [Updating](#updating)
4. [Uninstall](#uninstall)
5. [How it works](#how-it-works)
6. [Settings](#settings)
7. [To-do](#to-do)
8. [License](#license-gnu-general-public-license-v3)
6. [To-do](#to-do)
7. [License](#license-gnu-general-public-license-v3)

## Requirements

Expand All @@ -38,9 +37,6 @@ brew tap nicasso/gg
brew install gg
```

Changes are only available in a new shell session. To make changes immediately
available, run `source ~/.bashrc` (or your shell config file like `.zshrc`).

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

## Updating
Expand All @@ -64,29 +60,21 @@ brew untap nicaso/gg

## How it works

*GG* handles multiple git commands for you for faster and easier single commit merge requests.

1. `checkout` First we create a new branch with the provided name;
2. `commit` Then we create the commit with the provided commit message;
3. `push` After that we push to the current branch;
4. `open pull request url` Then we look for the url that creates a pull request and open that in your browser;
5. `checkout to previous repo` Finally we checkout the repo you started from;

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

## Settings
*GG* combines multiple (Git) commands for you, for faster and easier single commit merge requests.

*GG* has no settings yet, but will probably have them in the future for more customization.
1. `git checkout` First it creates a new branch with the provided name;
2. `git commit` Then it creates the commit with the provided commit message;
3. `git push` After that it pushes to the created branch;
4. `open` Then it looks for the url used for creating a new merge request in the response of the git push command and opens that page in your browser;
5. `git checkout` Finally it does a checkout back to the repository you started from;

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

## To-do

There are still some things I need/want to create for this alias.
There are still some things that could be created in the future.

- Github support with their pull-request URL;
- Bitbucket support with their pull-request URL;
- A couple of customizable features;
- Supporting multiline commit messages.

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

Expand Down
10 changes: 8 additions & 2 deletions gg
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ if git checkout -b $1 2>&1 | grep -q "already exists"; then
exit 1
fi

git commit -m " $2 "
URL="$(git push origin HEAD 2>&1 | grep http | cut -d' ' -f 4)"
# 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 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)|(pull-requests/new)).*')"
open $URL
git checkout $CURRENT_BRANCH

0 comments on commit fe83c72

Please sign in to comment.