Git shortcuts/aliases - How to create

Git shortcuts FAQ: Can I create Git shortcuts (aliases) so I don't have to type out full Git commands like "git commit..."?

I've been reading the Pro Git book a lot lately, and the short answer is yes, you can create Git shortcuts so you don't have to type out the long Git commands. Here are several Git shortcut commands (referred to as "git aliases") from the Pro Git book:

git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status

Once you've enabled these, you can type things like:

$ git st

instead of

$ git status

and

$ git ci -m 'yada yada'

instead of

$ git commit -m 'yada yada'

Remembering Git shortcuts/aliases

Of course we all like less typing, so Git shortcuts like these are a good thing.

If you're used to Unix/Linux systems, you know that you can put these commands in one of your startup files (~/.bashrc, ~/.bash_profile), and they'll be available for you every time you log in.

Git has more shortcut/alias power than this, and for that information I recommend reading the Pro Git book online.

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.