chipbk10 chipbk10 - 3 months ago 19
Git Question

how to git push to a local branch?

I git clone a project on my computer and have a local master branch, let say A. Here, I create some local branches (let say B and C).

I made some changes in B and C. So, how do I can git push to merge the changes in B and C to A?

Normally, I see that

 git push origin master 
to push to the remote repository, but I want to push to a local branch.

Thanks

Answer

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.

Comments