I am new in git
and I am find it hard to wrap my head around the fact that everything is around snapshots/commits and not individual files.
So assume that I have a tree in my repository as follows.
C4 (HEAD,Master,Origin/Master)
*
C3
*
C2
*
C1
Now I branch out from here:
B1 (HEAD, testBranch)
*
C4 (HEAD,Master,Origin/Master)
*
C3
*
C2
*
C1
In my testBranch
I only modify 2 files of the whole repository. Just 2.
The development in master
in the remote repository continues so eventually we have the following tree:
C8(Master,Origin/Master)
*
B3(testBranch) C7
* *
B2 C6
* *
B1 C5
*
C4
*
C3
*
C2
*
C1
Now I have finished working on the branch and want to merge to master. But the master has moved further ahead.
But the only difference between B3
the latest of testBranch
and C8
the latest of master
are the changes in the 2 files that I originally started to work on when I forked the branch. But additionally testBranch
is "lest behind" the master
branch since other modifications have occurred.
So what will happen if I merge testBranch
to master
?
Will git
figure out that the only changes to merge are the 2 files I originally worked on?
Will I get conflicts? Should I not do a merge but a rebase? Why?