Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
316 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...