BestPractices
BestPractices

Reputation: 12876

Does a Git branch you merged in from become part of the Git branch you merged to?

,Let's say I have a "master" Git branch and a "feature" branch off of "master".

master    A -> B -> C -> D
feature        B -> E -> F -> G

and I merge "feature" into "master" i.e. merge, not rebase:

master    A -> B -> C -> D -> H

Does the entire commit history of the feature now (both conceptually and actually) become part of the history of master, since H will have two parents: D and G and therefore from the tip of master (which is "H") you can reach all commits A through H inclusive?

So really master is now:

master A -> B -> C -> D -> H
            \             /
              E -> F -> G

This seems to differ in my mind from CVS/SVN branches where after I merge in a feature branch to the main branch, I don't actually consider the feature branch as part of the main branch's history. Am I correct in thinking that the concept of a "branch" in Git is different from CVS/SVN branches in this way -- obviously the implementation of them is completely different but is the concept of a branch, in this way with respect to merging in a feature branch making that branch now part of the main branch history including all interim commits/checkins to the branch, the same or different between CVS/SVN and Git?

Upvotes: 2

Views: 77

Answers (1)

Michael Durrant
Michael Durrant

Reputation: 96454

Yes the history is added.

Yes git is quite different from SVN in respect to branches, forks and clones.

More info at: git branch, fork, fetch, merge, rebase and clone, what are the differences?

Upvotes: 1

Related Questions