Note that there are some explanatory texts on larger screens.

plurals
  1. POMy coworker's changes remove my commits in git
    text
    copied!<p>Occasionally, I encounter a really weird and frustration problem with git. I commit and push some changes that includes both new files and modified files, while my coworker commits some other unrelated stuff to different files.</p> <p>Now, when he pulls my changes, my newly added files are shown as untracked on his side, and my changes are reverted. Unaware of this, he commits and pushes to the repository, and my changes are completely forgotten by git.</p> <p>For example, if I changed file <code>A</code>, then if I do <code>git log -p A</code>, I cannot see his revert of my changes at all, I cannot see the commit where I changed it either. But if I look at git history and find that commit, my changes are there in that commit. My commits are still there in git history, but there is no git commit that reverts my stuff, but somehow it is reverted in the latest master because the changes in my commit has been removed from the master branch somehow.</p> <p>Has anyone encountered anything similar? My first thought was that he was pulling before committing his own changes, but he claims that he committed before pulling. Another possibility is that he has an IDE (PyCharm) with a git client inside (but he uses commandline git) that somehow corrupts git in his machine. Another thing to note is that he runs Windows while I run OS X, so maybe it could be a git version clash.</p> <p>One other thing that might be important: Doing <code>git log -p myfile</code> does <em>not</em> show the commit in which I changed it, <code>git log --follow -p myfile</code> shows my change, but shows no other change that reverted it.</p> <p>When I issue <code>git log</code>, I can see the commit where I made the change and the change related to <code>fileA</code>. It is only when I issue <code>git log -p fileA</code> I cannot see the changes to <code>fileA</code>. So, the commit is there, merged to master, but its effects have disappeared.</p> <p>Any ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload