Is there any git command to display the information about local branch?
For example, if I am branch A
, and created new branch B
with the comman开发者_开发技巧d
git checkout -b B
is there any way that sometimes later I can find out where branch B copied from?? (A) in this case
You could do git merge-base branchX branchY
that will give you the common parent. That will tell you when it split off the branch, but there is no way to tell who it split off of.
Have you tried gitk
?
Displays changes in a repository or a selected set of commits. This includes visualizing the commit graph, showing information related to each commit, and the files in the trees of each revision.
The various branches and tags are highlighted in the tree.
There no tracking of which branch was created from which, and the commits that each branch point to could change at any time.
But this might do what you need:
git branch --merged B
That will show the list of all branches that are ancestors of branch B. So if you are on branch B, it will show branch A until there are commits made to A that fork it off--then it will no longer show A unless you merge A back into B, then it will show A again.
精彩评论