Skip to content

Instantly share code, notes, and snippets.

@brunogama
Forked from gonchar/.gitconfig
Created January 14, 2021 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunogama/cc11520f20e1c74e23fecba6e335ddc2 to your computer and use it in GitHub Desktop.
Save brunogama/cc11520f20e1c74e23fecba6e335ddc2 to your computer and use it in GitHub Desktop.
git aliases
[alias]
# full status
rstatus = !sh -c 'git status -sb --ignore-submodules=dirty && git submodule foreach --recursive git status -sb --ignore-submodules=dirty' -
rstatus-no-subs = !sh -c 'git status -sb --ignore-submodules=all && git submodule foreach --recursive git status -sb --ignore-submodules=all' -
s = !sh -c 'git rstatus-no-subs' -
# fetches all modules
rfetch = !sh -c 'git fetch && git submodule foreach --recursive git fetch' -
# updates project and all submodules
r-fetch-pull-merge = !sh -c 'git rfetch && git submodule foreach --recursive git merge && git merge && git s' -
r-fetch-pull-rebase = !sh -c 'git rfetch && git submodule foreach --recursive git rebase && git rebase && git s' -
up = !sh -c 'git r-fetch-pull-rebase' -
# recursive push
rpush = !sh -c 'git submodule foreach --recursive git push && git push' -
pushall = push --recurse-submodules=on-demand
out = !sh -c 'git rpush' -
# recurisive checkout and pull
switch = !sh -c 'git submodule foreach --recursive git checkout $1 && git checkout $1' -
# merge branches
merge-branch-from-to = !sh -c 'echo "will merge $1 to $2" && git fetch && git checkout $1 && git rebase && git checkout $2 && git rebase && git merge $1 -m merge && git push && echo done' -
merge-branch-from-to-no-fetch = !sh -c 'echo "will merge $1 to $2" && git checkout $1 && git rebase && git checkout $2 && git rebase && git merge $1 -m merge && git push && echo done' -
bft = !sh -c 'git merge-branch-from-to $1 $2' -
rbft = !sh -c 'git rfetch && git submodule foreach --recursive git merge-branch-from-to-no-fetch $1 $2 && git merge-branch-from-to-no-fetch $1 $2 && git s' -
merge-branch-from-to-no-commit = !sh -c 'echo "will dry merge $1 to $2" && git fetch && git checkout $1 && git rebase && git checkout $2 && git rebase && git merge $1 --no-commit --no-ff && echo done' -
merge-branch-from-to-no-commit-no-fetch = !sh -c 'echo "will dry merge $1 to $2" && git checkout $1 && git rebase && git checkout $2 && git rebase && git merge $1 --no-commit --no-ff && echo done' -
safebft = !sh -c 'git merge-branch-from-to-no-commit $1 $2' -
rsafebft = !sh -c 'git rfetch && git submodule foreach --recursive git merge-branch-from-to-no-commit-no-fetch $1 $2 && git merge-branch-from-to-no-commit-no-fetch $1 $2 && git s' -
rnew-branch = !sh -c 'git submodule foreach --recursive git checkout -b $1 && git submodule foreach --recursive git push -u && git checkout -b $1 && git push -u' -
# tag
rtag = !sh -c 'git submodule foreach --recursive git tag -a $1 -m $1 && git tag -a $1 -m $1 && git submodule foreach --recursive git push --tags && git push --tags' -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment