GIT:在检查另一个分支之前是否需要提交我的分支,存储过程如何? [英] GIT: Do I need to commit my branch before checking out another branch, what about stashing?

查看:120
本文介绍了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?

解决方案

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.

这篇关于GIT:在检查另一个分支之前是否需要提交我的分支,存储过程如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆