我有一个分叉回购和一个私有回购。私人回购是基于分叉回购的附带项目。我在私人回购(即新的变化(中与master不同的分支机构工作。我希望能够偶尔获取新的更新,并将这些提交从分叉的repo添加到我在master以外的分支上的私有repo(即获取更新(,然后将这两个分支合并到dev中进行测试,然后再将其合并到master中。做这件事最好的方法是什么?
叉子->private/dev/fetch更新->私有/dev
private/dev/new changes->私有/dev
编辑:
好吧,我想好了从分叉到私人回购的推镜像操作的大部分步骤。但我想将--mirror推送到私有/dev/fetch更新,从fork/master
假设我们有git://forked-repo-url和git://private-repo-url,然后
# clone the private repo
git clone git://private-repo-url
# change dir into the private repo
cd private-repo
# add the forked repo as an another remote
git remote add forked git://forked-repo-url
# fetch the newly created forked repo remote
git fetch forked
# switch to a new branch `dev` in the local copy
git switch -c dev
# merge changes from the `main` branch of the forked repo into the local `dev` branch
git merge forked/main
# or better then merging rebase on it
git rebase forked/main