2016-10-18 11 views
1

私は私のrepo - master、production、staging、other_stuffにいくつかのブランチを持っています 私のプロダクションブランチをマスターとして設定し、私のマスターブランチの名前をmaster_legacyに変更したいと思います。マスターブランチの名前を変更し、別のブランチをマスターにする方法は?

どうすればいいですか? は実際に私がガイドを見つけたが、私はここでそれを実装することができるかどうか、わからない:

git checkout production 
git merge -s ours master 
git checkout master 
git merge production 
+1

に[gitのマスターに現在のブランチを変更]の可能な重複をたどる(http://stackoverflow.com/questions/2763006/change-the-current-branch-to -master-in-git) –

答えて

1

あなたは枝の名前を変更するgit branch -m <oldBranch> <newBranch>を使用することができます。あなたの場合:

git branch -m master master_legacy 
git branch -m production master 

トリックを行う必要があります。

0

私の提案は、現在のmasterブランチからmaster_legacyブランチを作成し、次にプロダクションブランチをmasterにマージすることです。その後、master_legacyブランチに現在のマスターブランチの状態があり、プロダクションブランチに追加されたすべての変更はmasterブランチになります。

また、本番ブランチをマスターにマージしたくない理由がありますか?

1

ただ、これらの簡単な手順

git checkout master 
git checkout -b master_backup 
git checkout production 
git branch -D master 
git checkout -b master 
git push -f origin master 
関連する問題