Tutorial :Creating a remote branch from another remote branch which isn't master


Git is making me pull my hair out. I know how to create a local branch that tracks a remote branch, but I want to create a remote branch which copies another remote branch, and then track. Creating a remote branch is also easy, but it seems to always uses the codebase in master, not in an arbitrary branch. What's the sequence of commands I need if I have these branches

origin/master  origin/somebranch  

and I want

*somebranch2  origin/master  origin/somebranch  origin/somebranch2  


git push origin origin/somebranch:refs/heads/somebranch2  git branch -b somebranch2 origin/somebranch2  

The first command is the most direct way of making a copy of a branch on a remote. The second command is simply for setting up the local branch (and it will track the new remote branch origin/somebranch2).

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »