Skip to content

Instantly share code, notes, and snippets.

@soham2008xyz
Last active May 19, 2017 15:32
Show Gist options
  • Save soham2008xyz/96fcf45162f4e933404110f194170722 to your computer and use it in GitHub Desktop.
Save soham2008xyz/96fcf45162f4e933404110f194170722 to your computer and use it in GitHub Desktop.
Shorthand aliases for common Git commands
#!/usr/bin/env bash
alias gi="git init"
alias grao="git remote add origin"
alias grso="git remote set-url origin"
alias gpom="git push origin master"
alias gpum="git push -u origin master"
alias gl="git log"
alias glo="git log --pretty --oneline"
alias gs="git status"
alias gp="git push"
alias gpl="git pull"
alias gf="git fetch"
alias gfo="git fetch origin"
alias gpf="git push --force"
alias gpt="git push --tags"
alias ga="git add"
alias gaa="git add --all"
alias gaaf="git add --all --force"
alias gcm="git commit -m"
alias gcam="git commit -am"
alias gca="git commit --amend"
alias gc="git clone"
alias gdh="git diff HEAD"
alias gr="git reset"
alias grh="git reset HEAD"
alias grH="git reset HEAD --hard"
alias gb="git branch"
alias gcb="git checkout -b"
alias gco="git checkout"
alias gst="git stash"
alias gsp="git stash pop"
@soham2008xyz
Copy link
Author

How to use

  1. Clone this to your home directory into .gitrc

    $ git clone https://gist.github.com/96fcf45162f4e933404110f194170722.git $HOME/.gitrc
  2. Add this line to your .bashrc:

    source $HOME/.gitrc/git-aliases.sh

How to update

$ cd $HOME/.gitrc && git pull

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