Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Git Essentials

You're reading from  Git Essentials

Product type Book
Published in Apr 2015
Publisher
ISBN-13 9781785287909
Pages 168 pages
Edition 1st Edition
Languages
Author (1):
Ferdinando Santacroce Ferdinando Santacroce
Profile icon Ferdinando Santacroce

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 $15.99/month. Cancel anytime}