Skip to content

Commit 2d6d0d8

Browse files
authored
Merge pull request #1609 from Morganov/feature/update-branches-names
Update branch name highlight
2 parents fc0f75f + 22e9208 commit 2d6d0d8

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

book/03-git-branching/sections/branch-management.asc

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Do not rename branches that are still in use by other collaborators.
8282
Do not rename a branch like master/main/mainline without having read the section "Changing the master branch name".
8383
====
8484

85-
Suppose you have a branch that is called _bad-branch-name_ and you want to change it to _corrected-branch-name_, while keeping all history.
85+
Suppose you have a branch that is called `bad-branch-name` and you want to change it to `corrected-branch-name`, while keeping all history.
8686
You also want to change the branch name on the remote (GitHub, GitLab, other server).
8787
How do you do this?
8888

@@ -93,7 +93,7 @@ Rename the branch locally with the `git branch --move` command:
9393
$ git branch --move bad-branch-name corrected-branch-name
9494
----
9595

96-
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.
9797
To let others see the corrected branch on the remote, push it:
9898

9999
[source,console]
@@ -113,10 +113,8 @@ $ git branch --all
113113
remotes/origin/main
114114
----
115115

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:
120118

121119
[source,console]
122120
----
@@ -131,19 +129,19 @@ Now the bad branch name is fully replaced with the corrected branch name.
131129
====
132130
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.
133131
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.
135133
====
136134

137-
Rename your local _master_ branch into _main_ with the following command
135+
Rename your local `master` branch into `main` with the following command:
138136

139137
[source,console]
140138
----
141139
$ git branch --move master main
142140
----
143141

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.
145143

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.
147145
This makes the renamed branch available on the remote.
148146

149147
[source,console]
@@ -162,10 +160,10 @@ git branch --all
162160
remotes/origin/master
163161
----
164162

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.
169167

170168
Now you have a few more tasks in front of you to complete the transition:
171169

@@ -176,7 +174,7 @@ Now you have a few more tasks in front of you to complete the transition:
176174
* Update references to the old branch in documentation.
177175
* Close or merge any pull requests that target the old branch.
178176

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:
180178

181179
[source, console]
182180
----

0 commit comments

Comments
 (0)