Skip to content

Instantly share code, notes, and snippets.

@gsomoza
Last active December 15, 2015 13:49
Show Gist options
  • Save gsomoza/5270172 to your computer and use it in GitHub Desktop.
Save gsomoza/5270172 to your computer and use it in GitHub Desktop.
Useful Git Aliases
[alias]
# Usage: git nff {merge-branch}
# Checks out {merge-branch}, pulls, and merges recursively with the branch where this command was executed.
# In other words: it merges the current branch into {merge-branch}.
nff = !bash -c 'cb="$(git rev-parse --abbrev-ref HEAD)" && git checkout "$1" && git pull && git merge --no-ff $cb' -
# Usage: git cbranch
# Returns the name of the current branch
cbranch = rev-parse --abbrev-ref HEAD
# Usage: git pushall [branch]
# Pushes to all remotes. Pushes only "branch" if specified.
pushall = !bash -c 'git remote | xargs -I rem -n 1 bash -c \"echo \\\"> Pushing to rem\\\" && git push rem \"$1\" \"' -
# Usage: git pullall
# Pulls from all remotes
pullall = !bash -c 'git remote | xargs -I rem -n 1 bash -c \"echo \\\"> Pulling from rem\\\" && git pull rem\"' -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment