Skip to content

Git aliases

VirtualMaestro edited this page Dec 8, 2019 · 6 revisions

Here is the list of the useful git aliases, which give the possibilities easily to: add/update/remove the framework. You can add these shortcuts to your .gitconfig file (under the [alias] block).

Work with submodules (framework)

subst = "!f() { git submodule status --recursive;}; f"

suba = "!f() { git submodule add $1 $2; git submodule update --init --recursive;}; f"

subu = "!f() { git submodule sync; git submodule update;}; f"

subur = "!f() { git submodule sync; git submodule update --remote --merge --recursive --force;}; f"

suburc = "!f() { git submodule sync; git submodule update --remote --merge --recursive --force; git commit -m "Submodules updated";}; f"

subrm = "!f() { git submodule deinit -f $1; git rm -f $1; git commit -m 'Removed submodule'; rm -rf .git/modules/$1;}; f"

Optional

Branching

co = "!f() { git checkout $1;}; f"

cou = "!f() { git checkout $1; git subur;}; f"

con = "!f() { git checkout -b $1; git track;}; f"

rbr = "!f() { git push origin :$1; git branch -D $1;}; f"

br = "!f() { git branch;}; f"

Working with tags

ptag = "!f() { git push --tags;}; f"

ctag = "!f() { git tag -a $1 -m "$1";}; f"

cptag = "!f() { git ctag $1; git ptag;}; f"

rtag = "!f() { git fetch --prune origin '+refs/tags/:refs/tags/'; git push origin --delete $1; git fetch --prune origin '+refs/tags/:refs/tags/';}; f"

Other

st = "!f() { git status;}; f"

pu = "!f() { git push origin HEAD;}; f"

addup = "!f() { git remote add upstream $1; git remote -v;}; f"

updfork = "!f() { git fetch upstream; git checkout master; git merge upstream/master;}; f"

upd = "!f() { git pull -r; git submodule update;}; f"

upds = "!f() { git stash save; git pull -r; git stash pop; git status;}; f"

track = "!f() { git push -u origin HEAD;}; f"

Home

Clone this wiki locally