Sync remote branch from remote git server

落花浮王杯 提交于 2019-12-11 21:19:33

问题


I have mirror all android repository into my local repository, but with new version release I found it it hard to update from upstream.

Here is the detail:

After I mirror android source, my modification is in my own branch my-jb-mr1 on my private server. my-jb-mr1 is branched from aosp jb-mr1.

  • master
  • ...
  • jb-mr1
  • my-jb-mr1

Now kitkat is release on aosp, I found I don't know how to update my private server to keep track on aosp. My idea is

  1. merge aosp master to my local repository master, then push to my private server
  2. branch the code based the branch node on aosp

But this seems does not work. Because the branch on aosp I want to keep track is kitkat-dev and kitkat-release. The master branch on aosp does not include all commits within the target branch.

What I want is to sync from aosp. After sync, the repository is like:

  • master
  • ...
  • jb-mr1
  • kitkat-dev
  • kitkat-release
  • my-jb-mr1

kitkat-release and kitkat-dev should exactly the same with the branch on aosp.

Could any one give me some hint how to handle this case?


回答1:


Normally the master branch of AOSP will be a superset of the most recent release branch, but I'm not sure that's the case right now and your question seems to confirm that. Don't expect it to be true all the time, especially not right after a release.

To push the Kitkat branches to your server, start by syncing a workspace from the AOSP servers:

repo init --mirror -u https://android.googlesource.com/platform/manifest -b kitkat-dev

Normally I'd suggest syncing the mirror manifest as described in the Using a local mirror part of the documentation, but right now the mirror manifest doesn't contain all gits that were added in Kitkat. I expect them to be added shortly.

When the sync is done, step into the workspace and push the new branches to your server:

repo forall -c 'git push ssh://yourserver.example.com/$REPO_PROJECT aosp/kitkat-dev:refs/heads/kitkat-dev aosp/kitkat-release:refs/heads/kitkat-release

You can also use wildcards to push all AOSP branches to your server:

repo forall -c 'git push ssh://yourserver.example.com/$REPO_PROJECT aosp/*:refs/heads/*


来源:https://stackoverflow.com/questions/19761462/sync-remote-branch-from-remote-git-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!