6

I have two branch :

:git branch
  dev1.1
*  master

I have some local changes to the master I want to push. How do I specifically push master branch only?

Billal Begueradj
  • 20,717
  • 43
  • 112
  • 130
Vacassal Alsk
  • 391
  • 1
  • 6
  • 19
  • https://git-scm.com/docs/git-push – axiac Sep 25 '16 at 17:52
  • 2
    Possible duplicate of [How to push a new local branch to a remote Git repository and track it too?](http://stackoverflow.com/questions/2765421/how-to-push-a-new-local-branch-to-a-remote-git-repository-and-track-it-too) – paulsm4 Sep 25 '16 at 17:53

4 Answers4

10

You can use the following:

git push <remote_alias> <branch_name>

So in your case, it would probably be:

git push origin master

Cisplatin
  • 2,860
  • 3
  • 36
  • 56
4

If you have already committed your change, then you can push your changes to remote from any branch.

git push origin branch_name

In your case, branch is master.

Shravan40
  • 8,922
  • 6
  • 28
  • 48
1

you could use something like this:

git push git@github.com:bliep/blup.git fork-feature:feature

This will push your local fork-feature branch to the feature branch of the git@github.com:bliep/blup.git repository! I use this to help out colleagues with their PR's sometimes.

Elmer
  • 9,147
  • 2
  • 48
  • 38
-2

If the history of your branch has changed and it is pointing to a different tip of the head, you'll need to do a force push as follows:

git push origin master - - force
ValyriA
  • 157
  • 2
  • 9