0

After pulling my colleague's last few commits before pushing mine, my own changes were correctly merged however my colleagues' changes were overridden by my commits.

Why is this happening?

Note that I use standard Git CLI, he uses PHPstorm GUI. When this issue occurs, it is always his changes that get discarded, never mine.

drake035
  • 3,955
  • 41
  • 119
  • 229
  • https://stackoverflow.com/questions/55149911/git-merge-overwrites-contents – Alexan Mar 19 '19 at 18:43
  • But we're working on the same branch always – drake035 Mar 19 '19 at 19:39
  • Forget about the branch names for a while. The names are meant to let you ignore the fact that what Git actually uses are commit hash IDs. Concentrate on the actual *hash IDs*, and look into what happens with each *commit* when you use `git push` or `git fetch` or `git merge`. – torek Mar 19 '19 at 20:23
  • Did either of you force push? – evolutionxbox Mar 20 '19 at 00:05
  • None of us force pushed – drake035 Mar 20 '19 at 09:17
  • It must have to do with the way you and he "merge the changes in". Can you investigate on how exactly he's proceeding in PHPStorm, and also post your pull command? It'll help to sort it out. – Romain Valeri Mar 20 '19 at 11:29
  • Does this happen only when you work on similar lines in the same file? When you look at the file history, do you see his changes? – mgershen Mar 24 '19 at 12:39
  • The issue is it happens with files that I didn't even touch. I've been moving away from Git CLI in favor of Github Desktop for a week now and the problem hasn't occurred yet. If it continues over the next few weeks I'll have to conclude that Git CLI merging process is problematical (but not the one of GH Desktop) – drake035 Mar 29 '19 at 20:17

0 Answers0