nbgitpuller icon indicating copy to clipboard operation
nbgitpuller copied to clipboard

Automagically resolve conflicts upon remote deletion/moves

Open nthiery opened this issue 6 years ago • 1 comments

Scenario:

  • Instructor creates repo with file A/b
  • Student nggitpulls repo
  • Student edit A/b
  • Instructor git rm A/b (variant: git mv A/b A/c)
  • Student nbgitpulls latest version

This currently results in a merge conflict. Instead, in the general spirit of nbgitpuller some opinionated decision should be made. Presumably:

  • leave local file untouched (tracked by git? not any more?)
  • warn the user: A/b was removed/renamed remotely; left local copy untouched

(thanks btw for this useful tool!)

nthiery avatar Feb 25 '19 08:02 nthiery

Yesterday I ran into the same problem. And then I wanted to see what happens if instructor re-adds the deleted file and then student nbgitpulls latest version:

  1. Instructor creates repo with file A/b
  2. Student nggitpulls repo
  3. Student edit A/b
  4. Instructor git rm A/b (variant: git mv A/b A/c)
  5. Instructor adds the file back (e.g. git revert <previous_commit>)
  6. Student nbgitpulls latest version

The result is that the file, which is edited locally, is renamed and untracked and the file from remote is pulled. That means even the file is tracked by git, nbgitpuller thinks that it is untracked and renames it. I am still not sure if this is another problem/bug. But if this behaviour is correct, then for the problem stated by @nthiery, nbgitpuller should also untrack local file (git rm <file> --cached). If you agree, I would like to work on this and make a PR.

bitnik avatar Mar 13 '19 15:03 bitnik