0

I have a project on bitbucket the I cloned locally. when I checkout a branch to work on a feature I want my commits to be available on the local feature branch ONLY then when everything is good to go, push all commits from local branch to remote one.

Currently when I push commits to the local branch using git push git always complains about this push, shows a use git push --set-upstream <remote branch> and exits.

How can I achieve this?

techi
  • 73
  • 6
  • 4
    `push` always updates the remote refs. If you want your changes on the local branch only, all you got to do is to checkout the local branch and `commit` your changes. – NullDev Mar 07 '23 at 10:56
  • 2
    In the terminology of git, "push commits to the local branch" doesn't make any sense. It's not clear what you are trying to do. – IMSoP Mar 07 '23 at 11:56
  • My previous answer may help, https://stackoverflow.com/a/38868412/6330106. For local branches, `git merge`, `git rebase` and `git cherry-pick` are more suitable. – ElpieKay Mar 07 '23 at 13:26

1 Answers1

1

So you don't need to push. When you commit your code it stores your updated code locally and will not send it to any remote.

Joshua Zeltser
  • 488
  • 2
  • 9