Git changes being lost - why?

后端 未结 9 2037
梦如初夏
梦如初夏 2021-02-13 20:42

Our development team is using git and we\'ve lost changes to files at least twice recently. We are using private Github repos.

In the current case, we can go back throug

9条回答
  •  半阙折子戏
    2021-02-13 21:41

    We had the same issue: Dev A made a change. Dev B made a change to something else. After Dev B pushed his changes the change that Dev A made "vanished." The change that Dev B made was weeks ago but it seemed no one had noticed the loss of Dev A's changes until now.

    The real reason the change "vanished" was that the tool we were using to view history (TFS) was showing an incorrect version of history. When we looked with different tools (SmartGit and SourceTree) we saw what really happened: Someone had overwritten the change while trying to fix a merge conflict and the overwrite was there in plain view.

    So, it was not git that was losing changes, it was the tool we were using giving us a false view of history. Just something to look out for.

    We've been using git for a year now and 99% of the time that something has "gone wrong" with git, it was actually caused by someone who did not really understand git. The only time it "was git" was a CRLF issue, but really that was because we didn't know git well enough and (thanks to SO) it was easy to handle.

    So, always look carefully and you'll probably find the problem boils down to someone not understanding git and doing something they shouldn't have.

提交回复
热议问题