Showing branch hierarchy at the command line?

后端 未结 6 1667
攒了一身酷
攒了一身酷 2021-01-29 23:53

I\'m curious if there is a way to show branch hierarchy on the command line? For instance if I use git branch, instead of seeing output like this:

*         


        
6条回答
  •  故里飘歌
    2021-01-30 00:42

    That's not how branches work from git's point of view. If I make some commits to branch a, create branch b from it, work there, and then do other work back on a:

    A -- B -- D <-- a
           \
            \
              C <-- b
    

    That's indistinguishable if you did it the other way around:

    A -- B -- C <-- b
           \
            \
              D <-- a
    

    The only way I can think of to find out from which branch certain branch originated is the reflog, but that's unreliable (entries older than 90 days are usually deleted).

提交回复
热议问题