0

i am working via pull requests

so i have upstream -- remote that points to the upstream repository origin -- remote that points to my repository and localy i am working in a branch -- "feature1".

when i finished working on my feature i need to get changes from upstream that others did while i was working on my feature and merge them with my changes. so in "feature1" i do:

-- git commit -m "this is my feature"
-- git checkout master
-- git fetch upstream
-- git merge upstream/master ( i keep master clean and make pr only from other branches)
-- git checkout feature1
-- git merge upstream/master

here i have a conflict in 1 file. i used eclipse to resolve it and add the file

-- git commit -m "i did merge"
-- git push origin feature1

and now i see that ALL of the files were overwritten by my merge. Why did this happen? Where was my mistake? how should it be done?

rigby
  • 1,280
  • 3
  • 13
  • 21
  • Git was able to resolve the merge, and conflicts in the files, without needing to ask you for input. This happens to me all the time. However, it is usually only a _problem_ if you and your coworkers were all working on the same area of the file (e.g. the same function). So you should stop doing this. – Tim Biegeleisen Sep 12 '16 at 10:33
  • Read here for a fix: http://stackoverflow.com/questions/5074452/git-how-to-force-merge-conflict-and-manual-merge-on-selected-file ... you can force Git to pause after completing every merge, giving you the chance to manually review both sides of the merge before committing. – Tim Biegeleisen Sep 12 '16 at 10:34
  • @TimBiegeleisen but if git had been able to resolve the conflict it wouldn't have shown a conflict it would just merge changes. right? – rigby Sep 12 '16 at 10:37
  • It showed a conflict in _one file_...but it obviously had no trouble resolving the other files. – Tim Biegeleisen Sep 12 '16 at 10:38

0 Answers0