简体   繁体   English

Git合并并选择冲突中的本地文件

[英]Git merge and select local file in conflicts

I have an flask project which I have deployed to openshift, which I maintain locally. 我有一个烧瓶项目,已部署到openshift,并在本地维护。 I deleted it from openshift and now would like to redeploy it. 我从openshift删除了它,现在想重新部署它。 In the openshift gui, I created the a python app and grabbed the openshift git repo; 在openshift gui中,我创建了一个python应用程序,并获取了openshift git存储库;

 ssh://*******@myproject.rhcloud.com/~/git/myproject.git/

I changed origin to the new url with: 我通过以下方式将源更改为新的网址:

git remote set-url origin ssh://*******@myproject.rhcloud.com/~/git/myproject.git/

Now based on https://developers.openshift.com/en/knowledge-base.html#sync-a-new-git-repo-with-an-existing-git-repo I want to pull and merge. 现在基于https://developers.openshift.com/en/knowledge-base.html#sync-a-new-git-repo-with-an-existing-git-repo我想要合并。

I tried: 我试过了:

$ git pull ssh://*******@myproject.rhcloud.com/~/git/myproject.git/               

From ssh://*******@myproject.rhcloud.com/~/git/myproject.git/
 * branch            HEAD       -> FETCH_HEAD
Auto-merging wsgi.py
CONFLICT (add/add): Merge conflict in wsgi.py
Auto-merging .openshift/markers/README.md
CONFLICT (add/add): Merge conflict in .openshift/markers/README.md
Auto-merging .openshift/cron/README.cron
CONFLICT (add/add): Merge conflict in .openshift/cron/README.cron
Automatic merge failed; fix conflicts and then commit the result.

Basically at this point If I understand correctly, I want to choose my local files over the remote files in all cases. 基本上到此为止,如果我理解正确,则在所有情况下都希望选择我的本地文件而不是远程文件。 What is the best way to do this. 做这个的最好方式是什么。

I'm suspecting a rebase may be in order but not sure. 我怀疑可能会重新安排基准,但不确定。

If you want to choose your local files over the remote files, do: 如果要在远程文件上选择本地文件,请执行以下操作:

git checkout --ours wsgi.py
git checkout --ours .openshift/markers/README.md
git checkout --ours .openshift/cron/README.cron
git commit -a

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

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