Skip to content

Commit a6aabc1

Browse files
committed
Rerere
1 parent 14799a9 commit a6aabc1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

book/05-distributed-git/1-distributed-git.asc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,29 @@ image::images/rebasing-2.png[History after cherry-picking a commit on a topic br
12431243

12441244
Now you can remove your topic branch and drop the commits you didn't want to pull in.
12451245

1246+
===== Rerere
1247+
1248+
(((git commands, rerere)))(((rerere)))
1249+
If you're doing lots of merging and rebasing, or you're maintaining a long-lived topic branch, Git has a feature called ``rerere'' that can help.
1250+
1251+
Rerere stands for ``reuse recorded resolution'' – it's a way of shortcutting manual conflict resolution.
1252+
When rerere is enabled, Git will keep a set of pre- and post-images from successful merges, and if it notices that there's a conflict that looks exactly like one you've already fixed, it'll just use the fix from last time, without bothering you with it.
1253+
1254+
This feature comes in two parts: a configuration setting and a command.
1255+
The configuration setting is `rerere.enabled`, and it's handy enough to put in your global config:
1256+
1257+
[source,shell]
1258+
----
1259+
$ git config --global rerere.enabled true
1260+
----
1261+
1262+
Now, whenever you do a merge that resolves conflicts, the resolution will be recorded in the cache in case you need it in the future.
1263+
1264+
If you need to, you can interact with the rerere cache using the `git rerere` command.
1265+
When it's invoked alone, it asks Git to check its database of resolutions and try to find a match with any current merge conflicts and resolve them (although this is done automatically if `rerere.enabled` is set to `true`).
1266+
There are also subcommands to see what will be recorded, to erase specific resolution from the cache, and to clear the entire cache.
1267+
Check `man git-rerere` for all the details.
1268+
12461269
==== Tagging Your Releases
12471270

12481271
(((tags)))(((tags, signing)))

0 commit comments

Comments
 (0)