作者:手机用户2602886747 | 来源:互联网 | 2023-06-12 12:56
我正在使用存储库(github.com/gravitystorm),该存储库的分支(github.com/giggls)和我自己的存储库(github.com/astridx)。
这是我的设置。
/$ git remote -v
astridx https://github.com/astridx/openstreetmap-carto-de.git (fetch)
astridx https://github.com/astridx/openstreetmap-carto-de.git (push)
giggls https://github.com/giggls/openstreetmap-carto-de.git (fetch)
giggls https://github.com/giggls/openstreetmap-carto-de.git (push)
origin https://github.com/gravitystorm/openstreetmap-carto.git (fetch)
origin https://github.com/gravitystorm/openstreetmap-carto.git (push)
在我无法更改的两个远程存储库(gravitystorm,giggle)中,有一个名为master
的分支-但两个master
分支均包含不同的数据。我想和两个主分支一起工作。
我到目前为止已经完成:
$ git pull giggls master
From https://github.com/giggls/openstreetmap-carto-de
* branch master -> FETCH_HEAD
Auto-merging water.mss
Auto-merging style.mss
CONFLICT (content): Merge conflict in style.mss
Auto-merging project.mml
Auto-merging CHANGELOG.md
CONFLICT (content): Merge conflict in CHANGELOG.md
Automatic merge failed; fix conflicts and then commit the result.
- 然后我认为fetch命令是一种解决方案。因为它不合并。但是我的数据也没有改变。
$ git fetch giggls master
From https://github.com/giggls/openstreetmap-carto-de
* branch master -> FETCH_HEAD
我想到的唯一解决方案是,我在计算机上对分支的命名不同。这是我为此使用的命令:
$ git branch giggls_master
$ git checkout giggls_master
Switched to branch 'giggls_master'
$ git pull giggls masterFrom https://github.com/giggls/openstreetmap-carto-de
* branch master -> FETCH_HEAD
CONFLICT ...
$ git fetch giggls
remote: Enumerating objects: 5,done.
remote: Counting objects: 100% (5/5),done.
remote: Total 7 (delta 5),reused 5 (delta 5),pack-reused 2
Unpacking objects: 100% (7/7),done.
...
$ git reset --hard giggls/master
HEAD is now at 2f8c9d19 GERMAN STYLE: Render localized railway station names in addition to local names
真的没有更好的解决方案吗?例如,其中分支不仅是master
,而且是giggls/master
。
我看到了这个问题:Git: Use two branches with same name from different remotes
我认为这是另一个问题。 master分支中的数据没有不同。在不同的提供程序(gihub,gitlab)上有两个分支机构