You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This replaces your bad-branch-name with corrected-branch-name, but this change is only local for now.
96
+
This replaces your `bad-branch-name` with `corrected-branch-name`, but this change is only local for now.
97
97
To let others see the corrected branch on the remote, push it:
98
98
99
99
[source,console]
@@ -113,10 +113,8 @@ $ git branch --all
113
113
remotes/origin/main
114
114
----
115
115
116
-
Notice that you're on the branch corrected-branch-name.
117
-
The corrected branch is available on the remote.
118
-
However the bad branch is also still present on the remote.
119
-
You can delete the bad branch from the remote:
116
+
Notice that you're on the branch `corrected-branch-name` and it's available on the remote.
117
+
However, the branch with the bad name is also still present there but you can delete it by executing the following command:
120
118
121
119
[source,console]
122
120
----
@@ -131,19 +129,19 @@ Now the bad branch name is fully replaced with the corrected branch name.
131
129
====
132
130
Changing the name of a branch like master/main/mainline/default will break the integrations, services, helper utilities and build/release scripts that your repository uses.
133
131
Before you do this, make sure you consult with your collaborators.
134
-
Also make sure you do a thorough search through your repo and update any references to the old branch name in your code or scripts.
132
+
Also, make sure you do a thorough search through your repo and update any references to the old branch name in your code and scripts.
135
133
====
136
134
137
-
Rename your local _master_ branch into _main_ with the following command
135
+
Rename your local `master` branch into `main` with the following command:
138
136
139
137
[source,console]
140
138
----
141
139
$ git branch --move master main
142
140
----
143
141
144
-
There's no _master_ branch locally anymore, because it's renamed to the _main_ branch.
142
+
There's no local `master` branch anymore, because it's renamed to the `main` branch.
145
143
146
-
To let others see the new _main_ branch, you need to push it to the remote.
144
+
To let others see the new `main` branch, you need to push it to the remote.
147
145
This makes the renamed branch available on the remote.
148
146
149
147
[source,console]
@@ -162,10 +160,10 @@ git branch --all
162
160
remotes/origin/master
163
161
----
164
162
165
-
Your local _master_ branch is gone, as it's replaced with the _main_ branch.
166
-
The _main_ branch is also available on the remote.
167
-
But the remote still has a _master_ branch.
168
-
Other collaborators will continue to use the _master_ branch as the base of their work, until you make some further changes.
163
+
Your local `master` branch is gone, as it's replaced with the `main` branch.
164
+
The `main` branch is present on the remote.
165
+
However, the old `master` branch is still present on the remote.
166
+
Other collaborators will continue to use the `master` branch as the base of their work, until you make some further changes.
169
167
170
168
Now you have a few more tasks in front of you to complete the transition:
171
169
@@ -176,7 +174,7 @@ Now you have a few more tasks in front of you to complete the transition:
176
174
* Update references to the old branch in documentation.
177
175
* Close or merge any pull requests that target the old branch.
178
176
179
-
After you've done all these tasks, and are certain the main branch performs just as the _master_ branch, you can delete the _master_ branch:
177
+
After you've done all these tasks, and are certain the `main` branch performs just as the `master` branch, you can delete the `master` branch:
0 commit comments