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
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,7 +102,7 @@ From https://github.com/paulboone/ticgit
102
102
* [new branch] ticgit -> pb/ticgit
103
103
----
104
104
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.
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.
106
106
(We'll go over what branches are and how to use them in much more detail in <<ch03-git-branching#ch03-git-branching>>.)
107
107
108
108
[[_fetching_and_pulling]]
@@ -124,15 +124,15 @@ It's important to note that the `git fetch` command only downloads the data to y
124
124
You have to merge it manually into your work when you're ready.
125
125
126
126
If your current branch is set up to track a remote branch (see the next section and <<ch03-git-branching#ch03-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)))
127
-
This may be an easier or more comfortable workflow for you; and by default, the `git clone` command automatically sets up your local master branch to track the remote master branch (or whatever the default branch is called) on the server you cloned from.
127
+
This may be an easier or more comfortable workflow for you; and by default, the `git clone` command automatically sets up your local `master` branch to track the remote `master` branch (or whatever the default branch is called) on the server you cloned from.
128
128
Running `git pull` generally fetches data from the server you originally cloned from and automatically tries to merge it into the code you're currently working on.
129
129
130
130
[[_pushing_remotes]]
131
131
==== Pushing to Your Remotes
132
132
133
133
When you have your project at a point that you want to share, you have to push it upstream.
134
134
The command for this is simple: `git push <remote> <branch>`.(((git commands, push)))
135
-
If you want to push your master branch to your `origin` server (again, cloning generally sets up both of those names for you automatically), then you can run this to push any commits you've done back up to the server:
135
+
If you want to push your `master` branch to your `origin` server (again, cloning generally sets up both of those names for you automatically), then you can run this to push any commits you've done back up to the server:
136
136
137
137
[source,console]
138
138
----
@@ -167,7 +167,7 @@ $ git remote show origin
167
167
----
168
168
169
169
It lists the URL for the remote repository as well as the tracking branch information.
170
-
The command helpfully tells you that if you're on the master branch and you run `git pull`, it will automatically merge in the master branch on the remote after it fetches all the remote references.
170
+
The command helpfully tells you that if you're on the `master` branch and you run `git pull`, it will automatically merge in the `master` branch on the remote after it fetches all the remote references.
171
171
It also lists all the remote references it has pulled down.
172
172
173
173
That is a simple example you're likely to encounter.
Copy file name to clipboardExpand all lines: book/03-git-branching/sections/rebasing.asc
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,8 +46,8 @@ $ git checkout master
46
46
$ git merge experiment
47
47
----
48
48
49
-
.Fast-forwarding the master branch
50
-
image::images/basic-rebase-4.png[Fast-forwarding the master branch.]
49
+
.Fast-forwarding the `master` branch
50
+
image::images/basic-rebase-4.png[Fast-forwarding the `master` branch.]
51
51
52
52
Now, the snapshot pointed to by `C4'` is exactly the same as the one that was pointed to by `C5` in <<rebasing-merging-example,the merge example>>.
53
53
There is no difference in the end product of the integration, but rebasing makes for a cleaner history.
@@ -95,8 +95,8 @@ $ git merge client
95
95
----
96
96
97
97
[[rbdiag_g]]
98
-
.Fast-forwarding your master branch to include the client branch changes
99
-
image::images/interesting-rebase-3.png[Fast-forwarding your master branch to include the client branch changes.]
98
+
.Fast-forwarding your `master` branch to include the client branch changes
99
+
image::images/interesting-rebase-3.png[Fast-forwarding your `master` branch to include the client branch changes.]
100
100
101
101
Let's say you decide to pull in your server branch as well.
102
102
You can rebase the `server` branch onto the `master` branch without having to check it out first by running `git rebase <basebranch> <topicbranch>` -- which checks out the topic branch (in this case, `server`) for you and replays it onto the base branch (`master`):
@@ -109,8 +109,8 @@ $ git rebase master server
109
109
This replays your `server` work on top of your `master` work, as shown in <<rbdiag_h>>.
110
110
111
111
[[rbdiag_h]]
112
-
.Rebasing your server branch on top of your master branch
113
-
image::images/interesting-rebase-4.png[Rebasing your server branch on top of your master branch.]
112
+
.Rebasing your server branch on top of your `master` branch
113
+
image::images/interesting-rebase-4.png[Rebasing your server branch on top of your `master` branch.]
114
114
115
115
Then, you can fast-forward the base branch (`master`):
Copy file name to clipboardExpand all lines: book/05-distributed-git/sections/contributing.asc
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -259,9 +259,9 @@ We'll go over this syntax in detail in <<ch07-git-tools#_commit_ranges>>.
259
259
From the above output, we can see that there is a single commit that John has made that Jessica has not merged into her local work.
260
260
If she merges `origin/master`, that is the single commit that will modify her local work.
261
261
262
-
Now, Jessica can merge her topic work into her master branch, merge John's work (`origin/master`) into her `master` branch, and then push back to the server again.
262
+
Now, Jessica can merge her topic work into her `master` branch, merge John's work (`origin/master`) into her `master` branch, and then push back to the server again.
263
263
264
-
First (having committed all of the work on her `issue54` topic branch), Jessica switches back to her master branch in preparation for integrating all this work:
264
+
First (having committed all of the work on her `issue54` topic branch), Jessica switches back to her `master` branch in preparation for integrating all this work:
265
265
266
266
[source,console]
267
267
----
@@ -534,8 +534,8 @@ $ git remote add myfork <url>
534
534
----
535
535
536
536
You then need to push your new work to this repository.
537
-
It's easiest to push the topic branch you're working on to your forked repository, rather than merging that work into your master branch and pushing that.
538
-
The reason is that if your work isn't accepted or is cherry-picked, you don't have to rewind your master branch (the Git `cherry-pick` operation is covered in more detail in <<ch05-distributed-git#_rebase_cherry_pick>>).
537
+
It's easiest to push the topic branch you're working on to your forked repository, rather than merging that work into your `master` branch and pushing that.
538
+
The reason is that if your work isn't accepted or is cherry-picked, you don't have to rewind your `master` branch (the Git `cherry-pick` operation is covered in more detail in <<ch05-distributed-git#_rebase_cherry_pick>>).
539
539
If the maintainers `merge`, `rebase`, or `cherry-pick` your work, you'll eventually get it back via pulling from their repository anyhow.
Copy file name to clipboardExpand all lines: book/05-distributed-git/sections/maintaining.asc
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -225,8 +225,8 @@ Now you have a topic branch that contains contributed work.
225
225
At this point, you can determine what you'd like to do with it.
226
226
This section revisits a couple of commands so you can see how you can use them to review exactly what you'll be introducing if you merge this into your main branch.
227
227
228
-
It's often helpful to get a review of all the commits that are in this branch but that aren't in your master branch.
229
-
You can exclude commits in the master branch by adding the `--not` option before the branch name.
228
+
It's often helpful to get a review of all the commits that are in this branch but that aren't in your `master` branch.
229
+
You can exclude commits in the `master` branch by adding the `--not` option before the branch name.
230
230
This does the same thing as the `master..contrib` format that we used earlier.
231
231
For example, if your contributor sends you two patches and you create a branch called `contrib` and applied those patches there, you can run this:
232
232
@@ -263,8 +263,8 @@ For example, if you've added a line in a file on the `master` branch, a direct c
263
263
264
264
If `master` is a direct ancestor of your topic branch, this isn't a problem; but if the two histories have diverged, the diff will look like you're adding all the new stuff in your topic branch and removing everything unique to the `master` branch.
265
265
266
-
What you really want to see are the changes added to the topic branch -- the work you'll introduce if you merge this branch with master.
267
-
You do that by having Git compare the last commit on your topic branch with the first common ancestor it has with the master branch.
266
+
What you really want to see are the changes added to the topic branch -- the work you'll introduce if you merge this branch with `master`.
267
+
You do that by having Git compare the last commit on your topic branch with the first common ancestor it has with the `master` branch.
268
268
269
269
Technically, you can do that by explicitly figuring out the common ancestor and then running your diff on it:
270
270
@@ -290,7 +290,7 @@ In the context of the `git diff` command, you can put three periods after anothe
290
290
$ git diff master...contrib
291
291
----
292
292
293
-
This command shows you only the work your current topic branch has introduced since its common ancestor with master.
293
+
This command shows you only the work your current topic branch has introduced since its common ancestor with `master`.
294
294
That is a very useful syntax to remember.
295
295
296
296
==== Integrating Contributed Work
@@ -370,8 +370,8 @@ To clearly understand this you could check out the https://github.com/git/git/bl
370
370
===== Rebasing and Cherry-Picking Workflows
371
371
372
372
(((workflows, rebasing and cherry-picking)))
373
-
Other maintainers prefer to rebase or cherry-pick contributed work on top of their master branch, rather than merging it in, to keep a mostly linear history.
374
-
When you have work in a topic branch and have determined that you want to integrate it, you move to that branch and run the rebase command to rebuild the changes on top of your current master (or `develop`, and so on) branch.
373
+
Other maintainers prefer to rebase or cherry-pick contributed work on top of their `master` branch, rather than merging it in, to keep a mostly linear history.
374
+
When you have work in a topic branch and have determined that you want to integrate it, you move to that branch and run the rebase command to rebuild the changes on top of your current `master` (or `develop`, and so on) branch.
375
375
If that works well, you can fast-forward your `master` branch, and you'll end up with a linear project history.
376
376
377
377
(((git commands, cherry-pick)))
@@ -384,7 +384,7 @@ For example, suppose you have a project that looks like this:
384
384
.Example history before a cherry-pick.
385
385
image::images/rebasing-1.png[Example history before a cherry-pick.]
386
386
387
-
If you want to pull commit `e43a6` into your master branch, you can run
387
+
If you want to pull commit `e43a6` into your `master` branch, you can run
388
388
389
389
[source,console]
390
390
----
@@ -517,7 +517,7 @@ $ ls *.tar.gz
517
517
v1.6.2-rc1-20-g8c5b85c.tar.gz
518
518
----
519
519
520
-
If someone opens that tarball, they get the latest snapshot of your project under a project directory.
520
+
If someone opens that tarball, they get the latest snapshot of your project under a `project` directory.
521
521
You can also create a zip archive in much the same way, but by passing the `--format=zip` option to `git archive`:
Copy file name to clipboardExpand all lines: book/07-git-tools/sections/bundling.asc
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,7 +84,7 @@ Unlike the network protocols which figure out the minimum set of data to transfe
84
84
85
85
In order to do that, you'll have to calculate the difference.
86
86
As we described in <<ch07-git-tools#_commit_ranges>>, you can specify a range of commits in a number of ways.
87
-
To get the three commits that we have in our master branch that weren't in the branch we originally cloned, we can use something like `origin/master..master` or `master ^origin/master`.
87
+
To get the three commits that we have in our `master` branch that weren't in the branch we originally cloned, we can use something like `origin/master..master` or `master ^origin/master`.
The `verify` sub-command will tell you the heads as well.
147
147
The point is to see what can be pulled in, so you can use the `fetch` or `pull` commands to import commits from this bundle.
148
-
Here we'll fetch the 'master' branch of the bundle to a branch named 'other-master' in our repository:
148
+
Here we'll fetch the `master` branch of the bundle to a branch named `other-master` in our repository:
149
149
150
150
[source,console]
151
151
----
@@ -154,7 +154,7 @@ From ../commits.bundle
154
154
* [new branch] master -> other-master
155
155
----
156
156
157
-
Now we can see that we have the imported commits on the 'other-master' branch as well as any commits we've done in the meantime in our own 'master' branch.
157
+
Now we can see that we have the imported commits on the `other-master` branch as well as any commits we've done in the meantime in our own `master` branch.
Copy file name to clipboardExpand all lines: book/07-git-tools/sections/replace.asc
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ The second line will just be commits four and five - that will be the recent his
31
31
32
32
image::images/replace1.png[]
33
33
34
-
Well, creating the historical history is easy, we can just put a branch in the history and then push that branch to the master branch of a new remote repository.
34
+
Well, creating the historical history is easy, we can just put a branch in the history and then push that branch to the `master` branch of a new remote repository.
35
35
36
36
[source,console]
37
37
----
@@ -151,7 +151,7 @@ c1822cf first commit
151
151
----
152
152
153
153
To combine them, you can simply call `git replace` with the commit you want to replace and then the commit you want to replace it with.
154
-
So we want to replace the "fourth" commit in the master branch with the "fourth" commit in the `project-history/master` branch:
154
+
So we want to replace the "fourth" commit in the `master` branch with the "fourth" commit in the `project-history/master` branch:
Copy file name to clipboardExpand all lines: book/07-git-tools/sections/rerere.asc
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -145,7 +145,7 @@ You can see that it "Recorded resolution for FILE".
145
145
146
146
image::images/rerere2.png[]
147
147
148
-
Now, let's undo that merge and then rebase it on top of our master branch instead.
148
+
Now, let's undo that merge and then rebase it on top of our `master` branch instead.
149
149
We can move our branch back by using `git reset` as we saw in <<ch07-git-tools#_git_reset>>.
150
150
151
151
[source,console]
@@ -249,4 +249,4 @@ $ git rebase --continue
249
249
Applying: i18n one word
250
250
----
251
251
252
-
So, if you do a lot of re-merges, or want to keep a topic branch up to date with your master branch without a ton of merges, or you rebase often, you can turn on `rerere` to help your life out a bit.
252
+
So, if you do a lot of re-merges, or want to keep a topic branch up to date with your `master` branch without a ton of merges, or you rebase often, you can turn on `rerere` to help your life out a bit.
0 commit comments