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/07-git-tools/sections/rerere.asc
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,27 +2,27 @@
2
2
=== Rerere
3
3
4
4
The `git rerere` functionality is a bit of a hidden feature.
5
-
The name stands for ``reuse recorded resolution'' and as the name implies, it allows you to ask Git to remember how you've resolved a hunk conflict so that the next time it sees the same conflict, Git can automatically resolve it for you.
5
+
The name stands for ``reuse recorded resolution'' and, as the name implies, it allows you to ask Git to remember how you've resolved a hunk conflict so that the next time it sees the same conflict, Git can resolve it for you automatically.
6
6
7
7
There are a number of scenarios in which this functionality might be really handy.
8
-
One of the examples that is mentioned in the documentation is if you want to make sure a longlived topic branch will merge cleanly but don't want to have a bunch of intermediate merge commits.
9
-
With `rerere` turned on you can merge occasionally, resolve the conflicts, then back out the merge.
8
+
One of the examples that is mentioned in the documentation is when you want to make sure a long-lived topic branch will ultimately merge cleanly, but you don't want to have a bunch of intermediate merge commits cluttering up your commit history.
9
+
With `rerere` enabled, you can attempt the occasional merge, resolve the conflicts, then back out of the merge.
10
10
If you do this continuously, then the final merge should be easy because `rerere` can just do everything for you automatically.
11
11
12
12
This same tactic can be used if you want to keep a branch rebased so you don't have to deal with the same rebasing conflicts each time you do it.
13
-
Or if you want to take a branch that you merged and fixed a bunch of conflicts and then decide to rebase it instead - you likely won't have to do all the same conflicts again.
13
+
Or if you want to take a branch that you merged and fixed a bunch of conflicts and then decide to rebase it instead -- you likely won't have to do all the same conflicts again.
14
14
15
-
Another situation is where you merge a bunch of evolving topic branches together into a testable head occasionally, as the Git project itself often does.
15
+
Another application of `rerere` is where you merge a bunch of evolving topic branches together into a testable head occasionally, as the Git project itself often does.
16
16
If the tests fail, you can rewind the merges and re-do them without the topic branch that made the tests fail without having to re-resolve the conflicts again.
17
17
18
-
To enable the `rerere` functionality, you simply have to run this config setting:
18
+
To enable `rerere` functionality, you simply have to run this config setting:
19
19
20
20
[source,console]
21
21
----
22
22
$ git config --global rerere.enabled true
23
23
----
24
24
25
-
You can also turn it on by creating the `.git/rr-cache` directory in a specific repository, but the config setting is clearer and it can be done globally.
25
+
You can also turn it on by creating the `.git/rr-cache` directory in a specific repository, but the config setting is clearer and enables that feature globally for you.
26
26
27
27
Now let's see a simple example, similar to our previous one.
28
28
Let's say we have a file named `hello.rb` that looks like this:
@@ -76,7 +76,7 @@ $ git rerere status
76
76
hello.rb
77
77
----
78
78
79
-
And `git rerere diff` will show the current state of the resolution - what you started with to resolve and what you've resolved it to.
79
+
And `git rerere diff` will show the current state of the resolution -- what you started with to resolve and what you've resolved it to.
80
80
81
81
[source,console]
82
82
----
@@ -99,7 +99,7 @@ $ git rerere diff
99
99
end
100
100
----
101
101
102
-
Also (and this isn't really related to `rerere`), you can use `ls-files -u` to see the conflicted files and the before, left and right versions:
102
+
Also (and this isn't really related to `rerere`), you can use `git ls-files -u` to see the conflicted files and the before, left and right versions:
0 commit comments