Skip to content

Instantly share code, notes, and snippets.

@simenbrekken
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save simenbrekken/ba11619c8eac13057104 to your computer and use it in GitHub Desktop.

Select an option

Save simenbrekken/ba11619c8eac13057104 to your computer and use it in GitHub Desktop.
Simple aliases for a better Git life
[alias]
start = checkout -b
stop = "!export feature_branch=`git rev-parse --abbrev-ref HEAD`; [[ $feature_branch == 'master' ]] && echo 'Cannot merge master' && exit 1; git checkout master && git merge --no-ff $feature_branch"
resume = "!git checkout $1 && git rebase master"
finish = "!export feature_branch=`git rev-parse --abbrev-ref HEAD`; git stop && git branch -d $feature_branch"

Start a feature branch. You should never commit to master:

$ git checkout master
$ git start my-feature

Stop working on the current feature branch and bring all changes into master.

$ git checkout my-feature
$ git stop

Resume work on a feature branch from master.

$ git checkout master
$ git resume my-feature

Finish up a feature:

$ git checkout my-feature
$ git finish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment