Search code examples
gitgithubgit-merge

The commit of parent of parent branch is not showing up in the github.com


There was a branch A which was branched out from develop and then there was a further subranch of A which was named B (suppose). Now the state is like this develop --> A --> B.

So once I merge A into develop, what happens to branch B.

Now I want to merge the latest develop changes into my current branch B, but the merge push is not showing up in the github.com but when I do git log it is in the logging tree.

I want to merge develop branch into my own branch B but the commit is not showing up in the remote, but there is a merge commit in the logging tree.


Solution

  • You have new commits on develop which are not in branch B:

    d--d--d--d--D--D (develop)
         /
        /
    a--a (A)
        \
         b--b--b (B)
    

    If you want to test B based on those new (D) commits, I would recommend to rebase B (assuming you are the only one working on it):

     git rebase --onto develop $(git merge-base B A) B
    
     # if there are no new commits on A, you can use instead:
     git rebase --onto develop A B
    

    That will replay all commits from B, starting from one after A, or after the common commit between B and A (git merge-base B A) up to B HEAD.

                     b'--b'--b' (B)
                    /
    d--d--d--d--D--D (develop)
         /
        /
    a--a (A)
    

    That way, no need to merge an integration branch like develop to anything: its history remain untouched.
    You rewrite B on top of develop, and can test it with everything develop has already integrated.