Skip to content

Instantly share code, notes, and snippets.

@zommarin
Forked from shbaz/gist:1188369
Created September 5, 2011 15:23
Show Gist options
  • Save zommarin/1195238 to your computer and use it in GitHub Desktop.
Save zommarin/1195238 to your computer and use it in GitHub Desktop.
git snippets
#
# Misc good to have commands when using git
#
# Setup user
git config --global user.name "First Last"
git config --global user.email first.last@domain.com
# Setup useful aliases
git config --global alias.ci commit
git config --global alias.st status
# Nice shell-level aliases
alias gst='git status'
alias gl='git pull'
alias gp='git push'
alias gd='git diff | mate'
alias gau='git add --update'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gcot='git checkout -t'
alias gcotb='git checkout --track -b'
alias glog='git log'
alias glogp='git log --pretty=format:"%h %s" --graph'
# Short and nice log
git log --pretty=oneline Path
# Create a new freestanding branch
git symbolic-ref HEAD refs/heads/<branch-name>
rm .git/index -ErrorAction SilentlyContinue
git clean -fdx
# Checkout files from version into current structure
git checkout <version> -- Paths/Files
# Ignore invalid (often self signed) HTTPS certs
git config --global http.sslVerify false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment