I have 2 branches (both locally and remotely on github). I will call them BranchA and BranchB. I have BranchA with commits c1, c2 and c3. I have BranchB only with commit c1. Both branches are totally updated with github, and I can check that BranchA has c1,c2 and c3 and BranchB has only c1.
I want to push from local BranchA to remote BranchB. To do this I try:
git push origin refs/heads/BranchA:refs/remotes/origin/BranchB
When I do this, I get a strange output:
Total 0 (delta 0), reused 0 (delta 0)
To https://github.com/<username>/<repo>.git
<hash> BranchA -> origin/BranchB
When I go to github I see that BranchB is not updated and still only has c1. Then, if I run the command again, it returns that everything is up to date.
This was confusing me, but it got worse since when I try to do the command without the full ref, like this:
git push origin BranchA:BranchB
...it worked.
I am very confused by this. I searched for it and I thought that using the full ref (/refs/heads/ for example) would never do any harm.
Why is this happening? Shouldn't it work when I specify the full branch name?