Yatin Yatin - 1 year ago 103
Git Question

Git push from local repo to origin

I need to ask this question but may be its way simple , but i tried searching for answer and the google results are all pointing me to an answer which is not working.

My current setup is

git branch -r
origin/HEAD -> origin/master

git branch
* m1

i created m1 as a repo using got checkout -br m1

I am making all my changes in the m1 local branch rather than i master and hence i made some change in my pom.xml and comiited it as shown below.

git log --graph --stat origin/master..
* commit c44d62aecef8bef168cc60303ef36dab47117428
Author: Yatin
Date: Wed Apr 10 13:38:44 2013 -0700

fixing error in pom.xml

map_reduce/pom.xml | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)

I want to push this change which i have made in the m1 local repo to origin
and i have tried this

git push origin m1

this basically creates a new remote repo called m1. I dont want to create a remote repo called m1 but just push the changes in m1 to origin. I am missing some fundamental concpet but not sure what it is. can someone tell me how can it be done ?

eis eis
Answer Source

You didn't specify which branch you want remotely, so it assumed origin/m1.


git push origin m1:master

The syntax is

git push remote local_branch:remote_branch
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download