Skip to content

Commit a113612

Browse files
committed
Merge pull request #302 from danny0838/remote-tracking-branch
Several "remote branch" should be "remote-tracking branch".
2 parents c9a161a + 0dfdb23 commit a113612

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
=== Remote Branches
33

44
(((branches, remote)))(((references, remote)))
5-
Remote branches are references (pointers) to the state of branches in your remote repositories.
6-
They're local branches that you can't move; they're moved automatically for you whenever you do any network communication.
7-
Remote branches act as bookmarks to remind you where the branches on your remote repositories were the last time you connected to them.
5+
Remote references are references (pointers) in your remote repositories, including branches, tags, and so on.
6+
You can get a full list of remote references explicitly with `git ls-remote (remote)`, or `git remote show (remote)` for remote branches as well as more information.
7+
Nevertheless, a more common way is to take advantage of remote-tracking branches.
8+
9+
Remote-tracking branches are references to the state of remote branches.
10+
They're local references that you can't move; they're moved automatically for you whenever you do any network communication.
11+
Remote-tracking branches act as bookmarks to remind you where the branches in your remote repositories were the last time you connected to them.
812

913
They take the form `(remote)/(branch)`.
1014
For instance, if you wanted to see what the `master` branch on your `origin` remote looked like as of the last time you communicated with it, you would check the `origin/master` branch.
@@ -45,7 +49,7 @@ Name this remote `teamone`, which will be your shortname for that whole URL.
4549
image::images/remote-branches-4.png[Adding another server as a remote.]
4650

4751
Now, you can run `git fetch teamone` to fetch everything the remote `teamone` server has that you don't have yet.
48-
Because that server has a subset of the data your `origin` server has right now, Git fetches no data but sets a remote branch called `teamone/master` to point to the commit that `teamone` has as its `master` branch.
52+
Because that server has a subset of the data your `origin` server has right now, Git fetches no data but sets a remote-tracking branch called `teamone/master` to point to the commit that `teamone` has as its `master` branch.
4953

5054
.Remote tracking branch for `teamone/master`
5155
image::images/remote-branches-5.png[Remote tracking branch for `teamone/master`.]
@@ -103,11 +107,11 @@ From https://github.com/schacon/simplegit
103107
* [new branch] serverfix -> origin/serverfix
104108
----
105109

106-
It's important to note that when you do a fetch that brings down new remote branches, you don't automatically have local, editable copies of them.
110+
It's important to note that when you do a fetch that brings down new remote-tracking branches, you don't automatically have local, editable copies of them.
107111
In other words, in this case, you don't have a new `serverfix` branch – you only have an `origin/serverfix` pointer that you can't modify.
108112

109113
To merge this work into your current working branch, you can run `git merge origin/serverfix`.
110-
If you want your own `serverfix` branch that you can work on, you can base it off your remote branch:
114+
If you want your own `serverfix` branch that you can work on, you can base it off your remote-tracking branch:
111115

112116
[source,console]
113117
----
@@ -122,7 +126,7 @@ This gives you a local branch that you can work on that starts where `origin/ser
122126
==== Tracking Branches
123127

124128
(((branches, tracking)))(((branches, upstream)))
125-
Checking out a local branch from a remote branch automatically creates what is called a ``tracking branch'' (or sometimes an ``upstream branch'').
129+
Checking out a local branch from a remote-tracking branch automatically creates what is called a ``tracking branch'' (or sometimes an ``upstream branch'').
126130
Tracking branches are local branches that have a direct relationship to a remote branch.
127131
If you're on a tracking branch and type `git pull`, Git automatically knows which server to fetch from and branch to merge into.
128132

0 commit comments

Comments
 (0)