merge - Comment remplacer la branche master à Git, entièrement, d'une autre branche

Mots clés : gitmergegit-branchgit

meilleur 5 Réponses merge - Comment remplacer la branche master à Git, entièrement, d'une autre branche

vote vote

90

git checkout seotweaks git merge -s ours master git checkout master git merge seotweaks 
vote vote

85

git branch -m master old-master git branch -m seotweaks master git push -f origin master 
vote vote

71

git branch -m master master-old  # rename master on local git push origin :master          # delete master on remote git push origin master-old       # create master-old on remote git checkout -b master seotweaks # create a new local master on top of seotweaks git push origin master           # create master on remote 
vote vote

60

git push [-f] origin seotweaks:master 
! [remote rejected] master (deletion of the current branch prohibited) 
git push origin :master 
vote vote

60

git config receive.denyDeleteCurrent ignore 
git branch -m master vabandoned                 # Rename master on local git branch -m newBranch master                  # Locally rename branch newBranch to master git push origin :master                         # Delete the remote's master git push origin master:refs/heads/master        # Push the new master to the remote git push origin abandoned:refs/heads/abandoned  # Push the old master to the remote 
git config receive.denyDeleteCurrent true 

Questions similaires