git - Pushing a branch to UPSTREAM after accidentally -


so there 2 remotes configured.

i made made feature branch no remote pre-configured , accidentally pushed upstream

git push upstream 

now branch there on upstream undesired wanna push origin , delete branch in upstream

what's safest way it?

its more simple think:

# create new branch desired name: git checkout -b <branch name>  # push desired branch git push origin <branch name>  # delete wrong branch upstream git push upstream --delete <branch delete> 

as best practice should add desired branch name pull/push. read on why.

here git v2.0 release notes explain change in way git treat push (simple vs matching). updated in git v2.0 fix default git push behavior.

prior git v2.0 when executed git push have pushed changed branches (all , not current branch).

git v2.0 release notes

backward compatibility notes

when git push [$there] not push, have used traditional matching semantics far (all branches sent remote long there branches of same name on there). in git 2.0, default simple semantics, pushes:

  • only current branch branch same name, , when current branch set integrate remote branch, if pushing same remote fetch from; or

  • only current branch branch same name, if pushing remote not fetch from.

you can use configuration variable push.default change this. if old-timer wants keep using matching semantics, can set variable matching, example. read documentation other possibilities.strong text


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -