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/03-git-branching/sections/rebasing.asc
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,7 @@ Finally, you went back to your server branch and did a few more commits.
73
73
image::images/interesting-rebase-1.png[A history with a topic branch off another topic branch.]
74
74
75
75
Suppose you decide that you want to merge your client-side changes into your mainline for a release, but you want to hold off on the server-side changes until it's tested further.
76
-
You can take the changes on client that aren't on server (`C8` and `C9`) and replay them on your `master` branch by using the `--onto` option of `git rebase`:
76
+
You can take the changes on `client` that aren't on `server` (`C8` and `C9`) and replay them on your `master` branch by using the `--onto` option of `git rebase`:
77
77
78
78
[source,console]
79
79
----
@@ -99,7 +99,7 @@ $ git merge client
99
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
-
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`):
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`):
103
103
104
104
[source,console]
105
105
----
@@ -201,8 +201,8 @@ So instead of the result we see in <<_merge_rebase_work>>, we would end up with
201
201
.Rebase on top of force-pushed rebase work.
202
202
image::images/perils-of-rebasing-5.png[Rebase on top of force-pushed rebase work.]
203
203
204
-
This only works if C4 and C4' that your partner made are almost exactly the same patch.
205
-
Otherwise the rebase won't be able to tell that it's a duplicate and will add another C4-like patch (which will probably fail to apply cleanly, since the changes would already be at least somewhat there).
204
+
This only works if `C4` and `C4'` that your partner made are almost exactly the same patch.
205
+
Otherwise the `rebase` won't be able to tell that it's a duplicate and will add another C4-like patch (which will probably fail to apply cleanly, since the changes would already be at least somewhat there).
206
206
207
207
You can also simplify this by running a `git pull --rebase` instead of a normal `git pull`.
208
208
Or you could do it manually with a `git fetch` followed by a `git rebase teamone/master` in this case.
@@ -229,7 +229,7 @@ That's how it happened, and the repository should preserve that for posterity.
229
229
230
230
The opposing point of view is that the commit history is the *story of how your project was made.*
231
231
You wouldn't publish the first draft of a book, and the manual for how to maintain your software deserves careful editing.
232
-
This is the camp that uses tools like rebase and filter-branch to tell the story in the way that's best for future readers.
232
+
This is the camp that uses tools like `rebase` and `filter-branch` to tell the story in the way that's best for future readers.
233
233
234
234
Now, to the question of whether merging or rebasing is better: hopefully you'll see that it's not that simple.
235
235
Git is a powerful tool, and allows you to do many things to and with your history, but every team and every project is different.
Copy file name to clipboardExpand all lines: book/03-git-branching/sections/remote-branches.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
@@ -3,7 +3,7 @@
3
3
4
4
(((branches, remote)))(((references, remote)))
5
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.
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
7
Nevertheless, a more common way is to take advantage of remote-tracking branches.
8
8
9
9
Remote-tracking branches are references to the state of remote branches.
@@ -31,7 +31,7 @@ If you run `git clone -o booyah` instead, then you will have `booyah/master` as
31
31
image::images/remote-branches-1.png[Server and local repositories after cloning.]
32
32
33
33
If you do some work on your local `master` branch, and, in the meantime, someone else pushes to `git.ourcompany.com` and updates its `master` branch, then your histories move forward differently.
34
-
Also, as long as you stay out of contact with your origin server, your `origin/master` pointer doesn't move.
34
+
Also, as long as you stay out of contact with your `origin` server, your `origin/master` pointer doesn't move.
35
35
36
36
.Local and remote work can diverge
37
37
image::images/remote-branches-2.png[Local and remote work can diverge.]
@@ -80,9 +80,9 @@ To https://github.com/schacon/simplegit
80
80
----
81
81
82
82
This is a bit of a shortcut.
83
-
Git automatically expands the `serverfix` branchname out to `refs/heads/serverfix:refs/heads/serverfix`, which means, ``Take my serverfix local branch and push it to update the remote's serverfix branch.''
83
+
Git automatically expands the `serverfix` branchname out to `refs/heads/serverfix:refs/heads/serverfix`, which means, ``Take my `serverfix` local branch and push it to update the remote's `serverfix` branch''.
84
84
We'll go over the `refs/heads/` part in detail in <<ch10-git-internals#ch10-git-internals>>, but you can generally leave it off.
85
-
You can also do `git push origin serverfix:serverfix`, which does the same thing -- it says, ``Take my serverfix and make it the remote's serverfix.''
85
+
You can also do `git push origin serverfix:serverfix`, which does the same thing -- it says, ``Take my serverfix and make it the remote's serverfix''.
86
86
You can use this format to push a local branch into a remote branch that is named differently.
87
87
If you didn't want it to be called `serverfix` on the remote, you could instead run `git push origin serverfix:awesomebranch` to push your local `serverfix` branch to the `awesomebranch` branch on the remote project.
0 commit comments