- Push to other remotes
- List all remotes
$ cat .git/config
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@192.168.0.1:/home/git/debug_version.git - Add a remote named "origin2"
$ git remote add origin2 git@192.168.0.1:/home/git/release_version.git
$ cat .git/config
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@192.168.0.1:/home/git/debug_version.git
[remote "origin2"]
fetch = +refs/heads/*:refs/remotes/origin2/*
url = git@192.168.0.1:/home/git/release_version.git
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master - Push branch master to origin2
$ git push origin2 master
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin2/master - If you want to remove remote "origin2"
$ git remote rm origin2 - Push to other branches
- List all branches
$ cat .git/config
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@192.168.0.1:/home/git/debug_version.git
[branch "master"]
remote = origin
merge = refs/heads/master - Create a branch named "golden"
$ git branch golden - Switch to golden
$ git checkout golden
$ git branch -a
* golden
master
remotes/origin/master - Push golden to remote origin/golden
$ git push origin golden
$git branch -a
* golden
master
remotes/origin/master
remotes/origin/golden - Fetch from other branches (not master)
- Ref: http://stackoverflow.com/questions/67699/how-do-i-clone-all-remote-branches-with-git
- Download the branch master
$ git clone git@192.168.0.1:/home/git/debug_version.git
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/golden
remotes/origin/master - If you want to take a peek at golden on upstream
$ git checkout origin/golden - Fetch from branch golden
$ git checkout -b golden origin/golden
$ git branch -a
* golden
master
remotes/origin/HEAD -> origin/master
remotes/origin/golden
remotes/origin/master
Thursday, January 6, 2011
Push/Fetch source to/from other remote/branch
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment