@@ -46,27 +46,21 @@ $ git checkout -b <branch> --track <remote>/<branch>
46
46
Running `git checkout` without specifying a branch has no effect except
47
47
to print out the tracking information for the current branch.
48
48
49
- `git checkout (-b |-B) <new-branch > [<start-point>]`::
50
-
51
- Specifying `-b` causes a new branch to be created as if
52
- linkgit:git-branch [1] were called and then checked out. In
53
- this case you can use the `--track` or `--no-track` options,
54
- which will be passed to `git branch`. As a convenience,
55
- `--track` without `-b` implies branch creation; see the
56
- description of `--track` below.
57
- +
58
- If `-B` is given, _<new-branch > _ is created if it doesn't exist; otherwise, it
59
- is reset. This is the transactional equivalent of
60
- +
61
- ------------
62
- $ git branch -f <branch> [<start-point>]
63
- $ git checkout <branch>
64
- ------------
49
+ `git checkout -b <new-branch > [<start-point>]`::
50
+
51
+ Create a new branch named _<new-branch > _, start it at _<start-point > _
52
+ (defaults to the current commit), and check out the new branch.
53
+ You can use the `--track` or `--no-track` options to set the branch's
54
+ upstream tracking information.
65
55
+
66
- that is to say, the branch is not reset/created unless "git checkout" is
67
- successful (e.g ., when the branch is in use in another worktree, not
68
- just the current branch stays the same, but the branch is not reset to
69
- the start-point , either).
56
+ This fails without making any changes if there's an error checking out
57
+ _<new-branch > _, for example if checking out the `<start-point > `
58
+ commit would overwrite your uncommitted changes.
59
+
60
+ `git checkout -B <branch> [<start-point>]`::
61
+
62
+ The same as `-b`, except that if the branch already exists it
63
+ resets `_<branch> _` to the start point instead of creating it.
70
64
71
65
`git checkout --detach [<branch>]`::
72
66
`git checkout [--detach ] <commit> `::
@@ -156,16 +150,14 @@ of it").
156
150
see linkgit:git-branch [1] for details .
157
151
158
152
`-B <new-branch > `::
159
- Creates the branch _<new-branch > _, start it at _<start-point > _;
160
- if it already exists, then reset it to _<start-point > _. And then
161
- check the resulting branch out. This is equivalent to running
162
- `git branch` with `-f` followed by `git checkout` of that branch;
163
- see linkgit:git-branch [1] for details .
153
+ The same as `-b`, except that if the branch already exists it
154
+ resets `_<branch> _` to the start point instead of creating it.
164
155
165
156
`-t`::
166
157
`--track[= (direct|inherit) ]`::
167
158
When creating a new branch, set up "upstream" configuration. See
168
- `--track` in linkgit:git-branch [1] for details .
159
+ `--track` in linkgit:git-branch [1] for details . As a convenience,
160
+ --track without -b implies branch creation.
169
161
+
170
162
If no `-b` option is given, the name of the new branch will be
171
163
derived from the remote-tracking branch, by looking at the local part of
0 commit comments