我如何隐藏一些我未提交的更改? [英] How do I stash just some of my uncommitted changes?
本文介绍了我如何隐藏一些我未提交的更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Git repo中发生了重大变化,并意识到需要将某些更改回溯到bugfix分支。我不想检查对 master
的所有更改,因为它们未经完全测试并准备就绪,但我确实想要将这些更改拉出来,
I was in the middle of a major change in my Git repo and realized that some of the changes needed to be backported to a bugfix branch. I don't want to check in all of my changes to master
because they're not fully tested and ready, but I do want to pull a few of these changes out and commit them to the bugfix branch, then return to master with my index as it was.
如何避免将所有更改提交到 master
但仍然将这些更改提交给我的bugfix分支?
How can I avoid committing all my changes to master
but still commit some of these changes to my bugfix branch?
推荐答案
git stash --patch
# select just the changes that you're not ready to commit
# now you have just the bugfix changes left in your index, so..
git stash
git checkout bugfix-branch
git stash pop
git commit -m "...."
git checkout master
git stash pop
这篇关于我如何隐藏一些我未提交的更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文