User login

What are your git shortcuts? Here are mine.

Searched words: 
git shortcuts

Two whole words were too much for me for the commonly used git commands, so i created three-letter aliases.

Maybe if we share, we won't be utterly useless if we are lucky enough to work on one another's machines when we are forced, unready to fly with our stubby three-letter wings, out of our own nests.

I use gcm for git commit -m (git commit and leave a message inline, between quotes), gst for git status, gad for git add (it was as short as ga but i never used it, so standardized on the not-quite-as-aggressively-short three letters).

Here's my entire current .bashrc include, which is mostly these git-related aliases:

# .bashrc-agaric is included from .bashrc with the following line in .bashrc:
# . /home/ben/customhome/.bashrc-agaric

# aliases for scripts: Agaric Git Clone and Drupal Head.
alias agc='. /home/ben/scripts/'
alias dh='. /home/ben/scripts/'

#Speed up constant git commands
alias gst='git status'
alias gad='git add'
alias gcm='git commit -m'
alias gg='git gui &'
# drupal-ready diff - run from relevant root directory
alias gdd='git diff --no-prefix --relative'
# handle the really annoying failure of git to delete removed directories
# cannot alias: only 2nd 2 interpreted: alias grm='git rm -r 2; rm -rf 2'
grm() {
  git rm -r $1
  rm -rf $1

# grep
alias gp='grep -nHR'

# Graphical vim shortcut, and prevent meaningless Ubuntu errors.
alias v='gvim 2>/dev/null'

# Initialize a working copy.
i() {
  cd ~/code/$1
  git pull


My shortcuts

Hi! Here are my shortcuts. I notice you've prefixed yours with "g", I chose "gi"; I thought that reduces the risk for name clashes with other apps.

(I also can't stand typing "git X" over and over again --- so terribly many keystrokes. (Hence "giX").).

$ alias | grep ' gi'
alias gia='git add'
alias giap='git add --patch'
alias giau='git add -u'
alias gib='git branch'
alias giba='git branch -a'
alias gibr='git branch -r'
alias gich='git checkout'
alias gici='git commit'
alias gid='git diff -C -C'
alias gid-less='git diff -C -C --color | less -R'
alias gidc='git diff --cached -C -C'
alias gidc-less='git diff --cached -C -C --color | less -R'
alias gidcl='gidc-less'
alias gidcw='git diff --cached -C -C -w'
alias gidl='gid-less'
alias gids='git diff -C -C --stat'
alias gidsw='git diff -C -C --stat -w'
alias gidw='git diff -C -C -w'
alias gidw-less='git diff -C -C -w --color | less -R'
alias gidwl='gidw-less'
alias gil='git log'
alias gil-less='git log --color | less -R'
alias gill='gil-less'
alias gimv='git mv'
alias girm='git rm'
alias girmc='git rm --cached'
alias gis='git status'
alias gitalias='. ~/.gitalias-magnus.rc'
alias giw='git whatchanged -p'
alias giwo='git whatchanged -p origin'

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Syntax highlight code surrounded by the {syntaxhighlighter SPEC}...{/syntaxhighlighter} tags, where SPEC is a Syntaxhighlighter options string or "class="OPTIONS" title="the title".
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.