How can I save an incompletely merged index in git?
I'm working on a lenghty merging process with several conflicts.
What can I do to save the intermediate state, in order to periodically keep backups in case disaste开发者_如何学Pythonr strikes?
You can commit your work in progress and push it on a server in a temporary branch. But to do that, you'll have to commit file with conflict markers (git add . ; git commit
). And I'll advice you not to do it, as it is too easy to miss one of the place in conflict when you come back to the merge. You can also try to squash your merge in progress (git squash save
), but I don't know if it is possible to push a squash reference on a server.
Another alternative would be to try to split your complex merge in smaller blocks, and to push each intermediate merge.
For example, if you have the following history:
*---*---*---*---*---*---*---*---*---A
\
\--*---0---1---2---3---4---5---B
And try to merge B into A, you can accomplish the same thing by first merging 0, then 1, then 2, then 3, ... then finally B (0, 1, 2, ... may not be successive commit, but some important milestones in the B branch).
This is the strategy we are using when doing complex merge. The merged branch may not be in a workable state during those merge, so don't push directly to A, but to another branch (A-B-merge), then once the merge is finished, push everything to A.
but for the specific case, one can't commit a merge in progress, which is what I'm looking for!
It should be possible to move temporary .git/MERGE_HEAD
(created when merging), commit, and restore .git/MERGE_HEAD
.
精彩评论