You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/02-git-basics/sections/remotes.asc
+12-4Lines changed: 12 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,19 @@ Collaborating with others involves managing these remote repositories and pushin
8
8
Managing remote repositories includes knowing how to add remote repositories, remove remotes that are no longer valid, manage various remote branches and define them as being tracked or not, and more.
9
9
In this section, we'll cover some of these remote-management skills.
10
10
11
+
[NOTE]
12
+
.Remote repositories can be on your local machine.
13
+
====
14
+
It is entirely possible that you can be working with a ``remote'' repository that is, in fact, on the same host you are.
15
+
The word ``remote'' does not necessarily imply that the repository is somewhere else on the network or Internet, only that it is elsewhere.
16
+
Working with such a remote repository would still involve all the standard pushing, pulling and fetching operations as with any other remote.
17
+
====
18
+
11
19
==== Showing Your Remotes
12
20
13
21
To see which remote servers you have configured, you can run the `git remote` command.(((git commands, remote)))
14
22
It lists the shortnames of each remote handle you've specified.
15
-
If you've cloned your repository, you should at least see `origin` – that is the default name Git gives to the server you cloned from:
23
+
If you've cloned your repository, you should at least see `origin` -- that is the default name Git gives to the server you cloned from:
16
24
17
25
[source,console]
18
26
----
@@ -94,7 +102,7 @@ From https://github.com/paulboone/ticgit
94
102
* [new branch] ticgit -> pb/ticgit
95
103
----
96
104
97
-
Paul's master branch is now accessible locally as `pb/master` – you can merge it into one of your branches, or you can check out a local branch at that point if you want to inspect it.
105
+
Paul's master branch is now accessible locally as `pb/master` -- you can merge it into one of your branches, or you can check out a local branch at that point if you want to inspect it.
98
106
(We'll go over what branches are and how to use them in much more detail in <<_git_branching>>.)
99
107
100
108
[[_fetching_and_pulling]]
@@ -112,7 +120,7 @@ After you do this, you should have references to all the branches from that remo
112
120
113
121
If you clone a repository, the command automatically adds that remote repository under the name ``origin''.
114
122
So, `git fetch origin` fetches any new work that has been pushed to that server since you cloned (or last fetched from) it.
115
-
It's important to note that the `git fetch` command only downloads the data to your local repository – it doesn't automatically merge it with any of your work or modify what you're currently working on.
123
+
It's important to note that the `git fetch` command only downloads the data to your local repository -- it doesn't automatically merge it with any of your work or modify what you're currently working on.
116
124
You have to merge it manually into your work when you're ready.
117
125
118
126
If your current branch is set up to track a remote branch (see the next section and <<_git_branching>> for more information), you can use the `git pull` command to automatically fetch and then merge that remote branch into your current branch.(((git commands, pull)))
@@ -208,7 +216,7 @@ paul
208
216
It's worth mentioning that this changes all your remote-tracking branch names, too.
209
217
What used to be referenced at `pb/master` is now at `paul/master`.
210
218
211
-
If you want to remove a remote for some reason – you've moved the server or are no longer using a particular mirror, or perhaps a contributor isn't contributing anymore – you can either use `git remote remove` or `git remote rm`:
219
+
If you want to remove a remote for some reason -- you've moved the server or are no longer using a particular mirror, or perhaps a contributor isn't contributing anymore -- you can either use `git remote remove` or `git remote rm`:
0 commit comments