Search code examples
gitgit-subtree

How can you see what branch is selected with git subtree?


I have created a repository "droid_fun", one called "droid_per" and another one called "droid_common".

Now, I have added a subtree from droid_fun to droid_common to the branch "master". How can I know in the future what branch I have selected? I will create separated branch (fun, per, etc.) in the common library, so it will be useful to know it.

Thanks :)


Solution

  • I think that information is lost. But as you fetch from the common repository, you can at least see the tip of the branches. This lets you possibly trace and understand which branch was merged into your branch.

    To do that, do:

    $ git log --graph --pretty=oneline --decorate --all
    

    Unfortunately, this could get tedious.

    If you have the discipline, you can write in your commit message which branch it was that you just merged in. That way, you can quickly look at the log and tell this:

    $ git log -- your/subtree/prefix