Skip to content

Commit 27d5641

Browse files
committed
Mention shortest command to track remote branches
1 parent 439c253 commit 27d5641

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
@@ -138,6 +138,15 @@ Branch serverfix set up to track remote branch serverfix from origin.
138138
Switched to a new branch 'serverfix'
139139
----
140140

141+
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:
142+
143+
[source,console]
144+
----
145+
$ git checkout serverfix
146+
Branch serverfix set up to track remote branch serverfix from origin.
147+
Switched to a new branch 'serverfix'
148+
----
149+
141150
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:
142151

143152
[source,console]

0 commit comments

Comments
 (0)