Merge current branch into HEAD
It says I have conflicting changes, so in this case I expect it to tell me the files that have conflicts but it expects me to revert my local changes and then pull
Master / \ branch1 branch2 (local) \ Master
When branch2 tries to commit changes to master fails. What should I do in this case? Manually copy files to some location, pull and the then use winmerge to merge the files? or is there a better way to to merge?
When I do a
git pull, it states that – local changes will be overwritten, so stash or commit the changes before pull.
commit the changes, and then
stash pop fails stating that the changes in working copy will be overwritten.
BTW, I never see a file with conflicts in either of the cases, even when I try a rebase.
2 Solutions collect form web for “Merge current branch into HEAD”
The answer to this question is hidden in plain view in the documentation. From
git help merge:
HOW TO RESOLVE CONFLICTS
After seeing a conflict, you can do two things:
Decide not to merge. The only clean-ups you need are to reset the index file to the HEAD commit to reverse 2. and to clean up working tree changes made
by 2. and 3.;
git merge --abortcan be used for this.
Resolve the conflicts. Git will mark the conflicts in the working tree. Edit the files into shape and
git addthem to the index. Use
git committo seal
You can work through the conflict with a number of tools:
Use a mergetool.
git mergetoolto launch a graphical mergetool which will work you through the merge.
Look at the diffs.
git diffwill show a three-way diff, highlighting changes from both the HEAD and MERGE_HEAD versions.
Look at the diffs from each branch.
git log --merge -p <path>will show diffs first for the HEAD version and then the MERGE_HEAD version.
Look at the originals.
git show :1:filenameshows the common ancestor,
git show :2:filenameshows the HEAD version, and
git show :3:filenameshows the
Looks like the best way to work with GIT is have branches.
GIT MERGE master ( to fetch the newer changes)
GIT Merge branch1
GIT Merge branch2
I dont think there any other way. Please correct me if i am wrong?
Is this correct, If yes, in this case working with branches is smooth!