GIT:我是否需要在检查另一个分支之前提交我的分支,隐藏怎么样?
我是 Git 新手,有点困惑。我有一个主分支并创建了第二个功能分支。
如果我在功能分支中进行更改,然后切换到 Master,如果不提交,我的更改会丢失吗?
存储在哪里发挥作用,它是您在切换分支之前执行的操作(但不想提交)还是只是恢复一些更改以便您可以暂时返回到以前的代码?
I'm new to Git and a bit confused. I have a Master branch and have created a second feature branch.
If I make changes in my feature branch and then switch to Master, will my changes be lost if I don't commit?
Where does stash come into play, is it something you do before you switch branches (but don't want to commit) or is it to simply revert some changes so you can get back to previous code temporarily?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除非你清理你的树,否则你不能换到另一个树枝。这是通过提交更改、恢复更改或将其保存到存储中来完成的。
You can't change to another branch unless you clean your tree. This is done by committing your changes, reverting them or saving them to the stash.
您可能不想将 stash 用于此目的。
如果您确实想同时在主分支和功能分支上进行开发,我建议克隆您的存储库,在克隆和主分支中工作,然后使用推和拉在它们之间移动更改。
如果您经常在它们之间切换,我建议您在切换之前检查一下;托运垃圾并没有什么问题; git 可以让以后很容易解决这个问题。
You probably don't want to use stash for this purpose.
If you really want to be developing on the master and a feature branch at the same time, I suggest cloning your repository, working in the clone and the master, and then using push and pull to move changes between them.
If you are switching frequently between them, I suggest checking in before you switch; there's nothing wrong with checking in garbage; git makes it easy to sort this out later on.