Skip to content

Instantly share code, notes, and snippets.

@n1kk
Last active November 22, 2021 09:41
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 n1kk/869c293646868aaa22fedad46e2e13d9 to your computer and use it in GitHub Desktop.
Save n1kk/869c293646868aaa22fedad46e2e13d9 to your computer and use it in GitHub Desktop.
my git aliases
# list all aliases
git config --global alias.ls-alias 'config --get-regexp alias'
# load ssh agent for this session to not enter key password every time
# actually they don't work via git aliases, you have to put it in your .bashrc
git config --global alias.ssh-agent \!"eval \`ssh-agent\`; ssh-add"
git config --global alias.sa ssh-agent
# puch local only branch to origin and create there remote branch with same name
git config --global alias.publish push -u origin HEAD
# clear staged files
git config --global alias.unstage 'reset HEAD --'
# clear all local branches leaving only master
git config --global alias.purge-branches '!git branch | grep -ve " master$" | xargs git branch -D'
# checkout master and get latest
git config --global alias.master '!git checkout master && git pull origin'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment