3

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?

lqhung93
  • 39
  • 1
  • 5
  • possible duplicate of [Default behavior of "git push" without a branch specified](http://stackoverflow.com/questions/948354/default-behavior-of-git-push-without-a-branch-specified) – Andrew C Apr 11 '15 at 16:09

1 Answers1

3

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
Oleksi
  • 12,947
  • 4
  • 56
  • 80
  • I tried it but when I see the graph of the remote repo, still it has many commits in `doing` branch in order that the `doing` branch is not appear in the graph. Can I force many commits in `doing` branch not to push to remote repo? @andrew-c – lqhung93 Apr 11 '15 at 16:28
  • If you've already pushed them, they will continue to appear. This will simply keep git from pushing those branches in the future. – Oleksi Apr 11 '15 at 17:01