When working with forks & branches for features and pull requests I often find myself needing common actions, like
- Create a new branch, and I don't care what it's named
- Update the last commit, and keep the commit message
- List all the branches I have with some description of what that branch is
Below are the scripts to do just that.
Git will find any command in your $PATH
that begins with git-
and allow you to use it as a native git command or alias. So for the scripts below, the invocation is very simple:
$ git ls
* feature_27745 27c8f25 Add `sudo su` permission to dev users.
master 10ce941 Merge pull request #62 from mikhail/feature_54821
git checkout master
$ git fb Demonstrating this love
Branch feature_32609 set up to track local branch master by rebasing.
Switched to a new branch 'feature_32609'
[feature_32609 76094e2] Demonstrating this love
$ git ls
* feature_32609 76094e2 Demonstrating this love
feature_27745 27c8f25 Add `sudo su` permission to dev users.
master 10ce941 Merge pull request #62 from mikhail/feature_54821
git add .
$ git update
[feature_32609 dbe0d03] Demonstrating this love
Date: Thu May 28 13:37:10 2015 -0700
1 file changed, 1527 insertions(+)
create mode 100644 patch
git push origin feature_32609 -f
Lastly, combinging some bash magic -- git-lsi
will provide an ls
with interactive menu.