ブランチの名前を変更する方法はたくさんありますが、より大きな問題に焦点を当てます。「クライアントが早送りし、ローカルでブランチをいじる必要がないようにする方法」。
最初の簡単な写真:

これは実際には簡単なことです。しかし、それを乱用しないでください。アイデア全体は、マージコミットに依存します。早送りが可能で、ブランチの履歴を別のブランチにリンクできるためです。
ブランチの名前を変更します。
# rename the branch "master" to "master-old"
# this works even if you are on branch "master"
git branch -m master master-old
新しい「マスター」ブランチの作成:
# create master from new starting point
git branch master <new-master-start-point>
親子履歴を持つマージコミットを作成します。
# now we've got to fix the new branch...
git checkout master
# ... by doing a merge commit that obsoletes
# "master-old" hence the "ours" strategy.
git merge -s ours master-old
と出来上がり。
git push origin master
これが機能するのは、merge
コミットを作成すると、ブランチを新しいリビジョンに早送りできるためです。
賢明なマージコミットメッセージの使用:
renamed branch "master" to "master-old" and use commit ba2f9cc as new "master"
-- this is done by doing a merge commit with "ours" strategy which obsoletes
the branch.
these are the steps I did:
git branch -m master master-old
git branch master ba2f9cc
git checkout master
git merge -s ours master-old