git branch can show more than only the name of branches (#tilPost)

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 …


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


Print Share Comment Cite Upload Translate
APA
Stefan Judis | Sciencx (2023-02-09T00:59:22+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/.
MLA
" » git branch can show more than only the name of branches (#tilPost)." Stefan Judis | Sciencx - Sunday March 29, 2020, https://www.scien.cx/2020/03/29/git-branch-can-show-more-than-only-the-name-of-branches-tilpost/
HARVARD
Stefan Judis | Sciencx Sunday March 29, 2020 » git branch can show more than only the name of branches (#tilPost)., viewed 2023-02-09T00:59:22+00:00,<https://www.scien.cx/2020/03/29/git-branch-can-show-more-than-only-the-name-of-branches-tilpost/>
VANCOUVER
Stefan Judis | Sciencx - » git branch can show more than only the name of branches (#tilPost). [Internet]. [Accessed 2023-02-09T00:59:22+00:00]. Available from: https://www.scien.cx/2020/03/29/git-branch-can-show-more-than-only-the-name-of-branches-tilpost/
CHICAGO
" » git branch can show more than only the name of branches (#tilPost)." Stefan Judis | Sciencx - Accessed 2023-02-09T00:59:22+00:00. https://www.scien.cx/2020/03/29/git-branch-can-show-more-than-only-the-name-of-branches-tilpost/
IEEE
" » git branch can show more than only the name of branches (#tilPost)." Stefan Judis | Sciencx [Online]. Available: https://www.scien.cx/2020/03/29/git-branch-can-show-more-than-only-the-name-of-branches-tilpost/. [Accessed: 2023-02-09T00:59:22+00:00]
rf:citation
» git branch can show more than only the name of branches (#tilPost) | Stefan Judis | Sciencx | https://www.scien.cx/2020/03/29/git-branch-can-show-more-than-only-the-name-of-branches-tilpost/ | 2023-02-09T00:59:22+00:00
https://github.com/addpipe/simple-recorderjs-demo