Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
296 views
in Technique[技术] by (71.8m points)

How to resume `git merge` after stashing the merge change

Let's assume I want to merge branch_B to branch_A. I did:

git checkout branch_A
git merge branch_B

This resulted into a wall of conflicts that took me quite a long time to fix. Then, I had to do something urgently on branch_C. I did:

git stash
git checkout branch_C

Now, I am done with the branch_C and want to continue with my merge. I did:

git checkout branch_A
git stash pop

However, the merge is now viewed as a simple diff between branch_A and my merge attempt. How do I unstash these changes as a merge being in progress?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can simply restart it and reload the stash results

git merge branch_B
git read-tree --reset -u stash

if you had work tree changes that weren't added, i.e. the stashed index state didn't match the stashed work tree, follow up with git read-tree stash^2 to reload the index.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...