gitgit-branchgit-pushgit-refspec

Push from remote branch to different remote branch


If I want to push the contents from a remote:master to the same remote but a different branch, how can I do this?

With git push remote.git master:mybranch I can push the local repo into the second branch

But what I'd like is push not from the local but from the remote

So remote:master -> remote:branch

Something like this?

git push remote.git 'refs/remotes/master:refs/remotes/mybranch'
git push remote.git 'refs/heads/master:refs/heads/mybranch'

Solution

  • You have to pull actual master into local branch (you can do it to new branch), and push to remote.