问题描述
我目前有一个项目包含更多的分支机构。主分店还没有合并很久。所以我想用最新的代码切换到master。你能给我一些必要的命令和步骤吗?
我正在一个有不同分支的项目中工作。最新的变化是在除了主人以外的一些分支。现在我的要求是:有没有办法将当前工作分支移到master而不与master进行合并,以避免冲突?
如果你想在 master 中具有与 other_branch 完全相同的文件状态并保存历史记录 - 请执行下一步(它比 reset
):
git checkout master
git checkout other_branch。
(含期间)
将 other_branch 完整复制到当前( master ):
然后进行常规提交。
<$ p $
$ b复制other_branch到主工作树 注意,来自 other_branch 的未跟踪(未编入索引)的文件(目录)将保留,如果它们未被master记录。要删除那些未跟踪的文件(目录): 请参阅获取更多详情 I have currently one of the project it contain more branches. master branch not yet merger long time. So i want switched to master with latest code. Can you please give me necessary commands and steps. Let me re-frame my question. I am working in a project with different branches. The latest changes were in some branch other than master. Now my requirement is: is there a way to move the current working branch to master without merging it with master, to avoid conflicts? If you want to have in master exactly the same files state as in other_branch and save history - do next (it is softer than (with period) This will make full copy of other_branch to current (master):Then make regular commit. Note, untracked (unindexed) files (directories) from other_branch will remain, if they are not tracked by master. To remove those untracked files (directories): See How to remove local (untracked) files from the current Git working tree? for more details 这篇关于如何将当前工作分支移动到git中的主分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! git add --all
git commit -m
git clean -fd
pre>
reset
):git checkout master
git checkout other_branch .
git add --all
git commit -m "* copy other_branch to master working tree"
git clean -fd