how to git push to a local branch?
Use git merge
instead to manipulate local branches.
git checkout master
git merge B
git merge C
If you really want to push a local branch to another local branch, git push . B:master
, though this is quite rare.
While on the master branch, have you tried
git merge B
This should merge your local branch B back into master, same can be done for branch C
https://git-scm.com/docs/git-merge
As others said, normally you want to switch to A and then merge from B instead.
However, if you do it regularly, in some edge cases it makes sense to set A as upstream branch for B
git checkout B
git branch --set-upstream-to A
# shorthand: git branch -u A
and then use git push from branch B like you asked.