Skip to content

Instantly share code, notes, and snippets.

@realshadow
Last active December 12, 2017 18:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save realshadow/c0b7aa19f2210a051e8a to your computer and use it in GitHub Desktop.
Save realshadow/c0b7aa19f2210a051e8a to your computer and use it in GitHub Desktop.
Git aliases - for mercurial users
[alias]
# -- git ff {source} into {destination}; e.g. git ff dev test
ff = !sh -c 'git checkout $2 && git merge "$1" && git checkout "$1"' -
su = submodule update --init --recursive
co = checkout
ci = commit
st = status
graph = !sh -c 'git log --graph --decorate --oneline -n "$1"' -
# -- moves all changes to a newly created branch (which means it can not exist locally)
rb = !sh -c 'git checkout -b $1' -
# -- git sync {branch that will be merged to all env branches}; e.g. git sync dev
sync = !sh -c 'git ff "$1" test && git ff "$1" stage && git ff "$1" prod' -
# -- pull with update
pm = !sh -c 'git stash && git pull && git stash pop' -
# -- remove submodule
rms = "!f(){ git rm --cached \"$1\";rm -r \"$1\";git config -f .gitmodules --remove-section \"submodule.$1\";git config -f .git/config --remove-section \"submodule.$1\";git add .gitmodules; }; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment