Why git doesn't ask how to merge some of the files? -
I am trying to merge the two branches. Suppose I have three files in three, A, B and C, A, B and C. And in the branch 'new' I have A and C and I have removed B. C is different from A and AC in 'Master'
Now I am merging 'Master' with 'new' and what GIT does, it changes with the 'new' version of 'C' instead of 'Master' version of C, It keeps B (which I really want to delete) and asks me to manually merge it. What is happening? I thought it would ask me about all the changes!
But! If I compare the two branches, then it shows all the differences correctly. As you are saying that Geeta is working to work, as you are saying.
Let's say I have a
b
and c
files with your content, following the following commands: You can test:
git init git ABC GIT commit - Add "initial commitment" to
then create branch
< Code> git checkout-b branch 1 & lt; Edit A, C & gt;
Then merge the branch from 1st to Thurs
GIT checkout master GIT merge Branch 1
In this case, git will forward your changes faster:
Fast Forward A | 4++ - B 5 ----- C | 6 +++ --- 3 files have been changed, 5 entries (+), 10 deletion (-) delete mode 100644b
If you have both Master
and branch1
.
Extra case from the comment:
Your file is AAAAAA
on the first line containing A
, B With
BBBBBBB
and C
with CCCCCC
. branch1
GIT checkout -b branch1
A
with DDDDD < / Code> Add
Change the first row of DDDD
In the second line of C
GIT RM BGIT AC GIT commit -m "Commitment of the branch 1 "combines
A
back
A Change the
with
to EEEEEE
(thus preparing a conflict) CCCCC
line to B
Add git ab git commit -m "Now we GIT MERGE BRANCH 1
CONFLICT (modified / deleted): B has been removed in Branch 1 and head modified. Automatically merge a left-handed crystal in: Fail to merge into automatic merge; Fix conflicts and then give results.
B
If there is still there, basically now you have to decide what to do now
add git B # coating You will see that C
has been modified (your branch1 < Changes made in / code> have been modified as portfolios!) But you must use the master version of the file: git checkout head c
< P> This behavior can be done for other mergers when there is no resistance but you Yual commitment will force git merge --no-commit & lt; Branch & gt; With
Comments
Post a Comment