开发者

no tree conflict after push/pull to/from central git repository using egit

We have 2 developers using EGit. One works on Windows, one works on Linux

And we set a policy for collaboration as following:

  • There is a central (bare) repository
  • Initially, each developer make a check out from the central repository and work locally.
  • When the two need to synchronise the work, we pull/push from/to the central repository.

We use t开发者_如何学运维he central repository as we think, with it, we can easily collaborate with more developers in the team in the future.

Everything works fine until we detect that there is no conflict at all when one developer modified a file that has been moved to other directory by the other. Here are the steps:

  • One developer, move a file to another location; commit it to his local repository; push it to the central repository.
  • The other one changes content of that (the same) file; commit it to his local repository. Pull the central repository.

We expect there is a conflict report when the second developer makes a "pull". But no conflict. And there are 2 files appear in his working directory (and in his local repository):

  • The one he modified
  • And the one that the first developer has moved to the other directory.

Could anyone tell us what is our mistake?

Is our way of working violates git's design?

We are new to git (being familiar with CVCS for a long time). Hitting this issue, we are very worry as that means it will be very difficult to merge the work of our team. We believe we must do something incorrectly. Thank you for clarify us.


My guess is that you didn't move the file. When you move a file it is a delete and create. When people add the change they usually forget to add the -u or -A option to include not just the new files, tracked files, but also the deleted files.

After the move of the file, make sure you stage the remove side of the change. If in doubt, check with git log --stat that you removed the file from the old location in the commit that does the move.

Hope this helps


As I am using Egit, there is no command line. And I am sure I checked both the deleted file and the added file when committing.

But strangely, I have tried again by:

  • Deleting my local repository (from repository view, right click, delete...)
  • Checkout again from central repo (clone)
  • And redo exactly steps that I mentioned above

Everything works as expected. There must be something problem with my previous local repository as I can make a Team > Pull. I need to make a Fetch then a Merge. After checking out again like above. It's OK now.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜