Skip to content

Instantly share code, notes, and snippets.

@aeinbu
Last active July 29, 2021 13:39
Show Gist options
  • Save aeinbu/d98f58c3bb3c717511c17216fb68d4a8 to your computer and use it in GitHub Desktop.
Save aeinbu/d98f58c3bb3c717511c17216fb68d4a8 to your computer and use it in GitHub Desktop.
Some practial aliases for Git
[alias]
refresh = !git fetch --all --prune && git checkout master && git pull --rebase && git lastbranch
amend = commit --amend --no-edit
lastbranch = checkout @{-1}
ql = log -10 --oneline --decorate --graph
qb = "!qb(){ git refresh && git checkout -b aei/PPN-$@; }; qb"
qc = "!qc(){ git checkout aei/PPN-$@; }; qc"
qa = "!qa(){ git refresh && git branch --remote | grep $@ | sed 's/origin\\///' | xargs git checkout && git pull --rebase && git rebase master; }; qa"
@aeinbu
Copy link
Author

aeinbu commented May 29, 2019

Creating an alias using git commands:

git config alias.amend "commit --amend --no-edit"

Note the use of quotes around multi word expressions.

Removing a git alias:

git config --unset alias.amend

Edit the configuration file in a texteditor

git config --edit --global

Or use you favorite editor to edit the ´.gitconfig´ in the user's home folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment