Git: Merging from Remote Branch
08 Feb 2010
Knowledge
Here is the problem, you need to merge some works from "stable" branch in "repo1" to your current "master" branch. Below are the steps you do.
First of all, add a remote repository
git remote add foo git@example.com:foo/repo1.gitthen download objects and refs from that newly added remote repository
git fetch foonow checkout the branch which will you merge, in this case "stable"
git checkout --track -b stable foo/stablethen you move back to your current directory
git checkout masterfrom this point, you can merge "stable" branch to your current "master" branch by using
git merge stableif the changes don't conflict, you're done. Alternatively, you can pick out individual commits from "repo1/stable" to your current branch by using
git cherry-pick refnumberGot better solutions? Please share it on the comments.
