Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 665713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:44:20+00:00 2026-05-13T23:44:20+00:00

Right now, when I type git branch it lists my branches in an arbitrary

  • 0

Right now, when I type “git branch”

it lists my branches in an arbitrary order.

What I would prefer would be if “git branch” listed my output in a tree like fasion, somethign like:

master
|-- foo
  |-- foo1
  |-- foo2
|-- bar
  |-- bar4

Where here, foo & bar were branched from master; foo1 & foo2 were branched from foo; bar4 was branched from bar.

Is this easy to accomplish?

[Command line utilities only. This needs to fit into my zsh/vim workflow.]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:44:20+00:00Added an answer on May 13, 2026 at 11:44 pm

    The answer below uses git log:

    I mentioned a similar approach in 2009 with “Unable to show a Git tree in terminal“:

    git log --graph --pretty=oneline --abbrev-commit
    

    But the full one I have been using is in “How to display the tag name and branch name using git log –graph” (2011):

    git config --global alias.lgb "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset%n' --abbrev-commit --date=relative --branches"
    
    git lgb
    

    Original answer (2010)

    git show-branch --list comes close of what you are looking for (with the topo order)

    --topo-order
    

    By default, the branches and their commits are shown in reverse chronological order.
    This option makes them appear in topological order (i.e., descendant commits are shown before their parents).

    But the tool git wtf can help too. Example:

    $ git wtf
    Local branch: master
    [ ] NOT in sync with remote (needs push)
        - Add before-search hook, for shortcuts for custom search queries. [4430d1b] (edwardzyang@...; 7 days ago)
    Remote branch: origin/master (git@gitorious.org:sup/mainline.git)
    [x] in sync with local
    
    Feature branches:
    { } origin/release-0.8.1 is NOT merged in (1 commit ahead)
        - bump to 0.8.1 [dab43fb] (wmorgan-sup@...; 2 days ago)
    [ ] labels-before-subj is NOT merged in (1 commit ahead)
        - put labels before subject in thread index view [790b64d] (marka@...; 4 weeks ago)
    {x} origin/enclosed-message-display-tweaks merged in
    (x) experiment merged in (only locally)
    
    NOTE: working directory contains modified files
    

    git-wtf shows you:

    • How your branch relates to the remote repo, if it’s a tracking branch.
    • How your branch relates to non-feature (“version”) branches, if it’s a feature branch.
    • How your branch relates to the feature branches, if it’s a version branch
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 375k
  • Answers 375k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer THe output windows shows you progress, it is not a… May 14, 2026 at 8:11 pm
  • Editorial Team
    Editorial Team added an answer From http://java.sun.com/developer/technicalArticles/javaserverpages/servlets_jsp/ How Do JSP Pages Work? A JSP page… May 14, 2026 at 8:11 pm
  • Editorial Team
    Editorial Team added an answer To keep the transparency you should do imagealphablending($image_p, false); instead… May 14, 2026 at 8:11 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.