问题描述
我最近开始对我的master分支进行一些更改以添加featureX.我创建了1个新文件,并编辑了6个其他文件.我尚未进行任何更改.暂时,我想在一个单独的分支上使用featureX,并保持原版不变,直到我确定featureX可以正常工作为止.
I have started making some changes recently to my master branch to add featureX. I have created 1 new file and edited 6 others. I have not committed any of the changes. For the time being, I would like to work on featureX on a separate branch and leave the master untouched until I am sure featureX works correctly.
我知道在开始对FeatureX进行这些更改之前,我应该已经启动了一个新分支,但是无论如何,我都可以将对master分支所做的未提交的更改获取到featureX分支中,并将master恢复到其先前的featureX状态?
I know I should have started a new branch before I started making these changes for featureX, but is there anyway to get the uncommitted changes I've made to the master branch into a featureX branch and restore the master to its pre featureX state?
推荐答案
创建新分支(git checkout -b your_new_feature
)应该可以完成工作-否则,您可以尝试以下操作:
Creating a new branch (git checkout -b your_new_feature
) should do the job - otherwise, you could try this:
git stash
git checkout -b your_new_feature
git stash apply
这篇关于将未完成的更改从主服务器移到分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!