This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis
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.
Reply to Stefan
This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis
Stefan Judis | Sciencx (2020-03-29T22:00:00+00:00) git branch can show more than only the name of branches (#tilPost). Retrieved from https://www.scien.cx/2020/03/29/git-branch-can-show-more-than-only-the-name-of-branches-tilpost/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.