Move work in progress to another computer during git merge conflict

Viewed 379

Beside using cp or something similar, is there a „git way“ of moving the work in progress of resolving a git merge conflict to another computer?

2 Answers

Unfortunately, no: the merging work you are doing is taking place in Git's index, plus your work-tree. There's no "Git" way to send these to another repository on another computer. (There should be, but is not.)

It is possible to make a transferable archive out of the entire work tree and .git directory and send that to another machine (or use scp -r or rsync or similar) to copy everything, including the index file(s). However, the index itself contains machine-specific stat data, so this is not guaranteed to work.

Git needs some way to dump out the index into a transferable form (git ls-files --stage, more or less) and then read it back elsewhere (i.e., transfer any blobs missing on the other machine, along with this text dump) while also saving and restoring the work-tree state. Ideally, there should be a way to turn all of this into a commit (that goes on no branch, a la stash commits), then "undo" it into the target machine. That would also provide a way to save a partial merge and pick it up again later, with backup. But it does not exist today.

If the work you have is already pushed to an upstream repository, and the work conflicts with another upstream branch, then you don't have to copy anything across; have the other machine pull the existing branches and then attempt the merge. That machine can then be used to resolve the conflict.

Related