当前位置: 动力学知识库 > 问答 > 编程问答 >

visual studio - Why does git think my file has been or should be deleted?

问题描述:

I'm working as part of a team using Visual Studio, using git provided by Visual Studio Team Services (was Visual Studio Online). We're using feature branches, and merging into a central branch as we complete our work.

My current work has been committed on the feature branch in an incomplete state, and one of my colleagues who is doing a separate part of the work (my work is C#/.net, theirs is web/UI) has done a temporary (uncommitted) merge in visual studio in order to check that our work will integrate correctly.

Their work has been committed to our central branch, without this merge apparently being completed, and as I am pulling updates from our central branch into my feature branch, a number of the files I have created on this feature branch appear to be deleted, without raising a merge conflict.

Why has this happened?

What can we do to prevent this?

How can I avoid picking through every file that I or another member of my team has changed in order to merge my changes without unexpected deletions/reverts?

网友答案:

This is a feature of git - when a source branch is merged into a destination branch, that merge will normally have a record of all changes made on the source branch, and my team-mate checked in a merge (unintentionally!) which did not record my changes, and git therefore saw those files as deleted, and my changes as being undone.

There's probably room for Visual Studio, as a git client, to improve clarity around whether a state you are committing is currently being interpreted as a merge and whether you can cancel the merge. There's also room for improvement on the branches view, which would have allowed me to find this erroneous merge more rapidly.

分享给朋友:
您可能感兴趣的文章:
随机阅读: