nikmin
nikmin

Reputation: 1843

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

Upvotes: 9

Views: 23588

Answers (3)

Faruk Sahin
Faruk Sahin

Reputation: 8726

You can use the following command:

git push -u origin newBranch

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

Upvotes: 10

samuil
samuil

Reputation: 5081

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).

Upvotes: 7

mamapitufo
mamapitufo

Reputation: 4810

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.

Upvotes: 1

Related Questions