Tulains Córdova Tulains Córdova - 1 year ago 63
Git Question

Git: how this bifurcation happen?


  • I have a local Git repo.

enter image description here

  • I have only on branch:

  • I used to have another branch but I merged it into
    and then deleted it.

  • Such merged and deleted branch bifurcated from

  • 0c81926
    was an --amend of

  • There is no tag nor any other comming pointing to
    . I understand that if some object was pointing to an ammended commit, such commit would continue to show in the history. But this is not the case.


  • Why didn't the history line flattened?

  • Why is still

  • How did it happen?

As I mentioned nothing points to it and I did a
git -gc
to clean up any hanging commit.

Answer Source

There is no tag nor any other [commit] pointing to c79dc19

That's not what the history shows.

Try running git show HEAD - it'll show what the two parents of the merge are. It looks from your graph like one is the c79dc19, and that's why it shows up in your history.

Most likely, either the branch really started at c79dc19 (so that was already on master), or the branch was merged to master as a fast-forward when c79dc19 was its head.

Worked illustration:

  1. initial state

    fe62 <=master <=HEAD
  2. new commit

    fe62 <- c79d <=master <=HEAD
  3. checkout new branch

    fe62 <- c79d <=master <=branch <=HEAD
  4. amend (on branch) gives a new commit 0c81 which replaces c79d on that branch but doesn't change master

    fe62 <- c79d <=master
         \- 0c81 <=branch <=HEAD
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download