Skip to content

Commit cd1b0a7

Browse files
committed
Merge pull request #268 from jojva/simpler-tracking
Mention shortest command to track remote branches
2 parents a004efa + 27d5641 commit cd1b0a7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

book/03-git-branching/sections/remote-branches.asc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,15 @@ Branch serverfix set up to track remote branch serverfix from origin.
146146
Switched to a new branch 'serverfix'
147147
----
148148

149+
In fact, this is so common that there's even a shortcut for that shortcut. If the branch name you're trying to checkout (a) doesn't exist and (b) exactly matches a name on only one remote, Git will create a tracking branch for you:
150+
151+
[source,console]
152+
----
153+
$ git checkout serverfix
154+
Branch serverfix set up to track remote branch serverfix from origin.
155+
Switched to a new branch 'serverfix'
156+
----
157+
149158
To set up a local branch with a different name than the remote branch, you can easily use the first version with a different local branch name:
150159

151160
[source,console]

0 commit comments

Comments
 (0)