Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Git Essentials

You're reading from   Git Essentials Create, merge, and distribute code with Git, the most powerful and flexible versioning system available

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher
ISBN-13 9781785287909
Length 168 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ferdinando Santacroce Ferdinando Santacroce
Author Profile Icon Ferdinando Santacroce
Ferdinando Santacroce
Arrow right icon
View More author details
Toc

Git aliases


In Chapter 2, Git Fundamentals – Working Locally we already mentioned Git aliases and their purpose; in this paragraph, I will suggest only a few more to help you make things easier.

Shortcuts to common commands

One thing you can find useful is to shorten common commands like git checkout and so on; therefore, these are some useful aliases:

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

Another common practice is to shorten a command by adding one or more options that you use all the time; for example set a git cm <commit message> command shortcut to alias git commit –m <commit message>:

$ git config --global alias.cm "commit -m"

Creating commands

Another common way to customize the Git experience is to create commands you think should exist, as we did in Chapter 2, Git Fundamentals – Working Locally with the git tree command.

git unstage

The classic example is the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime