How to stash my previous commit?

前端 未结 5 1770
感动是毒
感动是毒 2021-01-30 08:29

I\'ve got the following situation on my git log:

commit 111  <-- need to push it to the repository

commit 222  <-- need to stash this one

..         


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-30 08:47

    I solving doing this:

    Remove the target commit

    git revert --strategy resolve 222

    Save commit 222 to patch file

    git diff HEAD~2 HEAD~1 > 222.patch

    Apply this patch to unstage

    patch -p1 < 222.patch

    Push to stash

    git stash

    Remove temp file

    rm -f 222.patch

    Very simple strategy in my opinion

提交回复
热议问题