简体   繁体   English

git:我可以在开发环境(带有未合并的开发分支)中签出一个修补程序分支吗?还是可以跨分支?

[英]git: can I checkout a hotfix branch in a dev environment(with an unmerged dev branch) or will that cross branches?

I'm new to having git set up for multiple users. 我是为多个用户设置git的新手。 I typically used it by myself with only one branch. 我通常只在一个分支上使用它。 I have a questions that I couldn't find safe answer to via Google: 我有一个无法通过Google找到安全答案的问题:

If I'm currently pulling a feature development branch into my dev server to test the feature and I suddenly discover the need for a hotfix can I re-branch(checkout) the hotfix branch (part of master not dev), pull the files in and start working on/testing a hotfix or will my next "git add ." 如果我当前正在将功能开发分支拉入我的开发服务器以测试功能,并且突然发现需要修补程序,可以重新分支(签出)该修补程序分支(master而非dev的一部分),则将文件拉入并开始研究/测试修补程序,或者我的下一个“ git add”。 add the files from the feature branch(which are still on the server) to the hotfix branch therefore mixing the two branches? 将功能分支(仍在服务器上)中的文件添加到修补程序分支,因此混合两个分支?

If I understand your question, I think your asking if, having changes on the development branch, and then switch to a hot fix branch, will the changes get intermixed with the new branch? 如果我理解您的问题,我想您是在询问是否在开发分支上进行了更改,然后切换到热修复分支,这些更改是否会与新分支混合?

Typically, what I would do is use "git stash save" of any changes on the development branch, checkout the hot fix branch and dothe changes and commit, switch back to the development branch, and then "git stash pop..." To get the development changes back. 通常,我要做的是在开发分支上使用“ git stash save”进行任何更改,签出热修复分支并进行更改并提交,切换回开发分支,然后“ git stash pop ...”恢复开发更改。

You can do "git status" after each step to ensure the working area has what you expect. 您可以在每个步骤之后执行“ git status”,以确保工作区具有您所期望的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM