Skip to content

Instantly share code, notes, and snippets.

@cstuncsik
Created February 27, 2017 08:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cstuncsik/1fd09512acc95e9dfe243c6b482d50b3 to your computer and use it in GitHub Desktop.
Save cstuncsik/1fd09512acc95e9dfe243c6b482d50b3 to your computer and use it in GitHub Desktop.
Useful git aliases
# git please
# checks that your local copy of the ref that you’re overwriting is up-to-date before overwriting it.
# This indicates that you’ve at least fetched the changes you’re about to stomp.
git config --global alias.please 'push --force-with-lease'
# git commend
# quietly tacks any staged files onto the last commit you created, re-using your existing commit message
git config --global alias.commend 'commit --amend --no-edit'
# git it
# initializes your repository and creates an empty root commit in one quick step
git config --global alias.it \
'!git init && git commit -m “root” --allow-empty'
# git stsh
# stash only unstaged changes to tracked files
git config --global alias.stsh 'stash --keep-index'
# git stash (original)
# stash any changes to tracked files
# git staash
# stash untracked and tracked files
git config --global alias.staash 'stash --include-untracked'
# git staaash
# stash ignored, untracked, and tracked files
git config --global alias.staaash 'stash --all'
# git st
# more friendly status
git config --global alias.st 'status --short --branch'
# git glog
# friendly compact graphical log
git config --global alias.glog 'log --graph --abbrev-commit --decorate --all --format=format:"%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(dim white) - %an%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n %C(white)%s%C(reset)"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment