Today I came across How To Make Life Easier When Using Git by Shane Hudson. The article shares lots of useful git tricks, and one particularly caught my eye.
When you're working with git, you'll deal with several local branches. To get an overview of all the branches, you can use git branch -l
.
$ git branch -l
JonUK/master
adding-draw.io
fix-contributors
fix-puppeteer
* master
(END)
I learned that the branch
command also provides two other flags that can come in handy. git branch -v
shows you the list of branches, including their last commit.
$ git branch -v
JonUK/master 6fce128 Used an IIFE for better browser compatibility
adding-draw.io 7351a8c draw.io added to helper library
fix-contributors 75da189 Set github access token to maybe avoid rate limiting
fix-puppeteer a2b633b Fix headless chrome on zeit
* master a04c5bb Update desc of css arrows
(END)
And git branch -vv
even goes further and shows you the last commit plus a possibly available tracked remote branch. ๐ฒ
$ git branch -vv
JonUK/master 6fce128 Used an IIFE for better browser compatibility
adding-draw.io 7351a8c draw.io added to helper library
fix-contributors 75da189 Set github access token to maybe avoid rate limiting
fix-puppeteer a2b633b Fix headless chrome on zeit
* master a04c5bb [origin/master] Update desc of css arrows
(END)
That's pretty cool, and I'll switch my workflow from using git branch -l
to using git branch -vv
in the future.
Top comments (0)