Reputation: 569
I am a bit new in github and I am seeing something which never happened to me when using gerrit. I have a repo with three branches, let's call them ==> a,b,c. When I type
git branch -a
I can see:
remotes/origin/HEAD -> origin/master
remotes/origin/a
remotes/origin/master
remotes/origin/b
remotes/origin/c
Imagine I want to change something in b. I do the following:
git checkout -b b_branch remotes/origin/b
Then I do the change. Add it and commit it. When I check the logs of git, I can see that there is one extra commit compared to the list of commits in the remore repo. Then, I do:
git push origin remotes/origin/b
However, nothing gets uploaded and I can see that it says:
Total 0 (delta 0), reused 0 (delta 0)
And if I do a simple push, it says: Everything up-to-date. However, the git log shows one extra commit.
Am I doing anything wrong? Why I can't commit my changes to the branch?
Upvotes: 1
Views: 218
Reputation: 124666
To push the local b_branch
to the remote b
branch, write like this:
git push origin b_branch:b
When the name of the local branch is the same as the name of the remote branch, the syntax is simply:
git push origin branchname
When the names are different, you need to use the more verbose but explicit
syntax with :
separating the local and remote branch names.
Upvotes: 2