GIT 替换分支的内容
我有一个包含以下分支的裸存储库设置:
dev
*master
stage
prod
我已将其克隆到工作副本并发出以下命令:
git checkout -b stage remotes/origin/stage
git checkout -b dev remotes/origin/dev
我需要做的是将暂存分支的全部内容推送到我的开发分支中。基本上,这是第一次设置,我首先将生产代码推送到暂存分支(工作完美),现在我将暂存代码推送到开发分支。
我遇到的问题是二进制文件的合并冲突。我如何告诉 git 甚至不要查看合并冲突,而是直接将 stage 分支的内容复制到 dev 分支中?
I've got a bare repo setup with the following branches:
dev
*master
stage
prod
I've cloned this to a working copy and issued the following commands:
git checkout -b stage remotes/origin/stage
git checkout -b dev remotes/origin/dev
What I need to do is push the entire contents of my staging branch into my dev branch. Basically, this is a first-time setup, and I started with pushing production code into a staging branch (worked flawlessly) and now I'm pushing my staging code into the dev branch.
The problem I'm encountering is a merge conflict on binary files. How do I tell git to not even LOOK at merge-conflicts, and instead just straight up copy over the contents of the stage branch into the dev branch?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听起来像
--s ours
的merge
选项正是您所需要的。http://book.git-scm.com/5_advanced_branching_and_merging.html
Sounds like
--s ours
option ofmerge
is right what you need.http://book.git-scm.com/5_advanced_branching_and_merging.html
您有几个选择:
选项 1 和 3 可能是最好的。您需要了解 DAG(谷歌“计算机科学家的 git”)。
我们使用以下工作流程:https://plus.google.com/109096274754593704906/posts/R4qkeyRadLR
这对我们来说非常好。
You have a few options:
Options 1 and 3 are probably best. You need to know the DAG (google "git for computer scientist").
We use this work flow: https://plus.google.com/109096274754593704906/posts/R4qkeyRadLR
It's been very good for us.
决定修复它的最简单方法是这样做:
克隆存储库两次,一次复制到开发文件夹中,一次复制到阶段文件夹中
然后
不优雅,但它完成了工作,并且比处理 git 的合并冲突要少得多。
Decided the simplest way to fix it was to do this:
clone the repo twice, once into a dev folder once into a stage folder
then
Inelegant but it got the job done, and was a lot less painful than dealing with git's merge conflicts.