Tips for using Git effectively
The Git command is powerful, and provides many niceties for quick navigation. In this section, we'll cover some tips for speeding up our Git command-line usage.
Switching Git branches with git checkout -
Similar to our tip from the previous chapter, the hyphen character can be used as a quick shortcut for toggling between our two most recent Git branches:
This is useful when working on a feature branch, as we can switch back and forth between branches without having to type any branch names!
Fixing typos with Git's autocorrect
Ever typed git chekcout
instead of git checkout
, or git stauts
instead of git status
? Git has an autocorrect mode, where, following a configurable timeout, it will automatically run the closest command to what we typed. If there's more than one possible interpretation, it will not run anything...