Problem: I want to push branch from one remote to another remote. Here is what I have done so far:
note: I have one remote already let say origin1
git remote add origin2 repolink.git
git fetch origin2
now I have local origin2
and its branches.
Structure:
local
master
remote
origin1
master
origin2
master
branch123
Require: I want to push local:master
to orgin2:branch123
. branch123
already have source files and commits.
option:1 origin2:branch123
last commit can be parent of local:master
init commit. I guess that might be rebasing.
option:2 origin2:branch123
is forcefully replaced by local:master
. In which case I will lose commits of origin2:branch123 which was branched by origin2:master
. I don't know whether in this case local:master
will conflict with origin2:master
in doing so (option:2)
which option is safe. I prefer rebasing
because origin2:branch123
last commit is almost identical to remote1:master
init commit
.
Please see image:
Please advise which option is safe or best and what commands are useful. I am a bit naive right now in version control management.
question from:
https://stackoverflow.com/questions/65862913/how-to-push-remote1master-to-remote2branch123-safely 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…