git - Pushing a branch to UPSTREAM after accidentally -
so there 2 remotes configured.
- my fork(origin) -> origin
git@github.com:anirudh/testrepo.git
- the main repo fork made.(upstream) -> upstream https://github.com:anirudh/testrepo.git
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 traditionalmatching
semantics far (all branches sent remote long there branches of same name on there). in git 2.0, defaultsimple
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 usingmatching
semantics, can set variablematching
, example. read documentation other possibilities.strong text
Comments
Post a Comment