push from local branch to different remote branch
I have 2 branches named
Current on remote. In local I’m working on branch
developer and I push my changes to remote
developer. The question is, how can I push from local
developer to remote
I have tried these:
- Push a branch of a git repo to a new remote (github), hiding its history
- Strange remote branch in git
- Git : Do not allow users to push a new branch to remote repo
- Git: what exactly causes remote branches to update?
- git add remote tracking branch to bare repo
- GIT: remove remote branches with no local tracking branch
git push origin Current -f // error: // src refspec Current does not match any. // failed to push some refs to ... // and this one too: git config push.default upstream git push origin Current -f // error: same as the first try // and this one too: git branch --set-upstream-to developer origin/Current // or: git branch --set-upstream-to developer Current // error: fatal: branch 'Current' (or 'origin/Current') does not exist
2 Solutions collect form web for “push from local branch to different remote branch”
While on your
developer branch, try
git push -u origin Current.
-u is shorthand
--set-upstream. It looks like using
git branch requires the upstream branch to already exist; this isn’t the case when using it with
You can do:
git push origin developer:current
This will push branch
developer from your local repo to branch
current on the remote repo. In case you are overwriting changes on branch current, you will need to use the
-f flag as well.
FWIW, doing a
git push origin :current (note the
current) will delete the branch
current from the remote.