Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to push only current branch from local to remote repo in git?

Tags:

git

git-branch

My local repo has 2 branches: master and doing, I only create commits in doing branch and when I finish the project, I merge it to master branch. When I checkout master branch and push to the remote repo, 2 branches are pushed to the remote. How can I push only master branch to remote repo in order that, commits in doing branch are not appear on remote repo?

like image 984
lqhung93 Avatar asked Nov 02 '25 11:11

lqhung93


1 Answers

You can manually specify which branch to push:

git push origin master

Or you can configure git to always only push the current branch:

git config --global push.default simple
like image 146
Oleksi Avatar answered Nov 04 '25 00:11

Oleksi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!