Skip to content

Instantly share code, notes, and snippets.

@gonchar
Created April 20, 2015 12:53
Show Gist options
  • Save gonchar/2a5c48e51d05e8f47415 to your computer and use it in GitHub Desktop.
Save gonchar/2a5c48e51d05e8f47415 to your computer and use it in GitHub Desktop.
Git aliases
[alias]
# full status
s = !git status -sb --ignore-submodules=dirty && git submodule foreach --recursive git status -sb --ignore-submodules=dirty
# updates project and all submodules
up = !git submodule foreach --recursive git pull --rebase && git pull --rebase
# updates and creates all submodules (can move sumbmodules from there brunches)
subup = submodule update --init --recursive
# fetches all modules
rfetch = !git fetch && git submodule foreach --recursive git fetch
# mergeBranch(from, to) e.g. git bft master next
bft = "!echo \"merge $1 to $2\" && git checkout $1 && git pull --rebase && git checkout $2 && git pull --rebase && git merge $1 -m merge && gi$
safebft = "!echo \"merge $1 to $2\" && git checkout $1 && git pull --rebase && git checkout $2 && git pull --rebase && git merge $1 --no-commi$
history = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
# recurisive checkout and pull
switch = !sh -c 'git submodule foreach --recursive git checkout $1 && git checkout $1 && git up && git s' -
rswitch = !sh -c 'git submodule foreach git checkout $1 && git checkout $1' -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment