我刚刚在错误的子分支中做了一些更改。
我有 master 分支,并且从中我有分支 A 和 B。在分支 A 中,已经有来自 master 的更改。分支 B 尚未创建。
我刚刚在分支 A 中对分支 B 进行了所需的更改。这些更改仅在我的计算机上,我还没有在我的计算机上提交它们,也没有将它们同步到 Git 上的 A 分支。(我在 VisualStudio 中完成所有这些)。
有什么方法可以将我的计算机上的更改推送/移动到新的分支 B 吗?我编辑的每个文件在 master 和 A 中都是相同的。
查看git help stash。由于您尚未对这些文件进行提交 - 您的工作空间因您想要移动的更改而“脏” - 您可以将它们移动到存储中。
git stash # make your working directory clean, save the changes for later
git checkout master
git checkout -b B # create your new branch from master
git stash pop # apply the changes to the new branch
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4375 次 |
| 最近记录: |