Moving Patches across repositories
Best work flow to deal with cross repository merging is to add both repositories in one local directory. Then you're able to merge and cherry pick across the different repositories.
For the sake of example I'll show how to merge b2_8_fe
into b_2_8_fe_sgi
. These are two different repositories.
Clone a base repository:
git clone ssh://ashehata@git.whamcloud.com:29418/fs/lustre-release-fe-sgi git checkout b2_8_fe_sgi # checkout the remote SGI branch
Add FE remote repository:
git remote add 2.8-fe ssh://ashehata@git.whamcloud.com:29418/fs/lustre-release-fe git pull 2.8-fe
"2.8-fe
" is the name you give the remote repository.
Do the merge:
git merge 2.8-fe/b2_8_fe
At this point b2_8_fe_sgi
has been fast forwarded to b2_8_fe
.
To list remote branches
git branch -rv
To list current repositories being tracked in your local directory
git remote
To create a copy of a branch into another repo
git checkout repo1/branch1 git push repo2 HEAD:branch1
To delete remote branch
git push repoX :branch_to_delete
Also when pushing to create remote branch, the HEAD
in the command above you can just be replaced with a commit hash, if you don't feel like checking out the branch.
Same works with merging, if you don't want to merge whole branch, but only up to a certain point, you can use commit hash id instead of whole branch path.
Rebase also works against remote branches in the ways you would expect.
Git procedure to rebase and update a remote branch
git clone ssh://ashehata@review.whamcloud.com:29418/fs/lustre-release git checkout multi-rail git fetch origin master git merge origin/master git push origin multi-rail # to grab only a few patches git checkout multi-rail git checkout <SHA> git push origin HEAD:multi-rail
Using local branches
Cherry-pick from a local repository. Useful when pulling features from one repository to another
git remote add <other> /path/to/local/repo/.git git fetch <other>
Remove the added repository
git remote remove <other>
1 Comment
Anonymous