Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git push branch without merge

I have one branch master on the server (remote). I created new local branch that doesn't exist on the remote (server). How can I add (push) the branch to the remote (server) without merging it with the master branch

like image 725
nikmin Avatar asked Nov 23 '12 13:11

nikmin


3 Answers

You can use the following command:

git push -u origin newBranch

-u will set up your local branch to track the remote branch.

like image 59
Faruk Sahin Avatar answered Sep 23 '22 21:09

Faruk Sahin


git push remote local_branch_name:remote_branch_name

Usually your remote will be origin, and both local and remote branch will be the same (although you can push local branch as a remote with different name). If their names are identical you don't have to provide colon-separated names -- one will be sufficient.

What you are trying to achieve has nothing to do with merging branches. I'd suggest further reading about branches and remotes (git-scm book is pretty good resource).

like image 42
samuil Avatar answered Sep 24 '22 21:09

samuil


You just push your local branch:

$ git push origin <your-branch>

You can use the -u flag to set your local brach to track the remote too.

like image 36
mamapitufo Avatar answered Sep 24 '22 21:09

mamapitufo