Skip to content

Instantly share code, notes, and snippets.

@micha149
Last active September 11, 2018 11:37
Show Gist options
  • Save micha149/1319346 to your computer and use it in GitHub Desktop.
Save micha149/1319346 to your computer and use it in GitHub Desktop.
Git commands
# Create a git alias with a colored history listing
git config --global alias.hist "log --all --format='[%C(cyan)%h%C(reset)] %C(red)%d%C(reset) %s %C(dim)# %an%C(reset)' --graph"
# call api from gitignore.io from console
git config --global alias.ignore "!gi() { curl -L -s https://www.gitignore.io/api/$@ ;}; gi"
# delete all merged branches except master, develop and the current checked out branch
git config --global alias.cleanup "!git branch --merged | grep -v '^\*\|master\|develop' | xargs -n1 git branch -d"
# Create temporary commit of staged changes and fixup it into the given commit
git config --global alias.fixup "!sh -c 'REV=$(git rev-parse $1) && git commit --fixup $@ && git rebase -i --autostash --autosquash $REV^' -"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment