Преименуване на началната клонка git

Примерен код

61
0

git преименувате и да е клон

git branch -m <oldname> <newname> # Any Branch
git branch -m <newname> # Current Branch

# For windows if you get "Branch already exists" error
git branch -M <newname>
3
0

git преименуване на master в main

$ git branch -m master main
2
0

преименуване на клон в основната

$ git push -u origin main
0
0

като преместите началната клонка в основните линии

# Step 1 
# create main branch locally, taking the history from master
git branch -m master main

# Step 2 
# push the new local main branch to the remote repo (GitHub) 
git push -u origin main

# Step 3
# switch the current HEAD to the main branch
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main

# Step 4
# change the default branch on GitHub to main
# https://docs.github.com/en/github/administering-a-repository/setting-the-default-branch

# Step 5
# delete the master branch on the remote
git push origin --delete master

Подобни страници

Подобни страници с примери

На други езици

Тази страница на други езици

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Íslensk
..................................................................................................................