Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Commonmark migration
Source Link

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.

 

[...] 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.

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.

 

[...] 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.

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.

[...] 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.

Mention the rerere-train.sh script in git-contrib
Source Link
Michael Wild
  • 26.7k
  • 3
  • 46
  • 44

However, it looks like rerere wasn't already activated before the merge, which means Git must have kept no record of how you resolved the conflict the first time. At this stage, you have no other choice but tocan either activate rerere now and resolve all those same conflicts manually again, or use the once and for allrerere-train.sh script (see also this blog post) to use the existing history to pre-seed the rerere cache.

However, it looks like rerere wasn't already activated before the merge, which means Git must have kept no record of how you resolved the conflict the first time. At this stage, you have no other choice but to activate rerere now and resolve all those same conflicts again, once and for all.

However, it looks like rerere wasn't already activated before the merge, which means Git must have kept no record of how you resolved the conflict the first time. At this stage, you can either activate rerere now and resolve all those same conflicts manually again, or use the rerere-train.sh script (see also this blog post) to use the existing history to pre-seed the rerere cache.

grammar fix, add syntax highlighting
Source Link
jub0bs
  • 67.3k
  • 27
  • 198
  • 200

TL;DRTL; DR

The --preserve-merges flag simply tells git-rebase to try to recreate merge commits instead of ignoring them. It does not give git rebase the ability of rememberingto remember how merge conflicts were resolved, i.e. it does not record conflict resolutions for future use. What you want to use for that is rerere.

git init echo Hello > Hello.txt git add Hello.txt git commit -m "Create Hello.txt (commit A)" git tag start echo World! >> Hello.txt git commit -am "Change to Hello World (commit B)" git checkout start git checkout -b branch echo Dave >> Hello.txt git commit -am "Change to Hello Dave (commit C)" 
git init echo Hello > Hello.txt git add Hello.txt git commit -m "Create Hello.txt (commit A)" git tag start echo World! >> Hello.txt git commit -am "Change to Hello World (commit B)" git checkout start git checkout -b branch echo Dave >> Hello.txt git commit -am "Change to Hello Dave (commit C)" 
git merge master 
git merge master 
echo "Hello World, Dave!" > Hello.txt git add Hello.txt git commit -m "Merge branch master into branch (commit D)" 
echo "Hello World, Dave!" > Hello.txt git add Hello.txt git commit -m "Merge branch master into branch (commit D)" 
git checkout start git checkout -b goodbye-branch echo Goodbye > Goodbye.txt git add Goodbye.txt git commit -m "Add Goodbye.txt (commit E)" 
git checkout start git checkout -b goodbye-branch echo Goodbye > Goodbye.txt git add Goodbye.txt git commit -m "Add Goodbye.txt (commit E)" 
git checkout branch git rebase -p goodbye-branch 
git checkout branch git rebase -p goodbye-branch 
git config --global rerere.enabled true 
git config --global rerere.enabled true 

TL;DR

The --preserve-merges flag simply tells git-rebase to try to recreate merge commits instead of ignoring them. It does not give git rebase the ability of remembering how merge conflicts were resolved, i.e. it does not record conflict resolutions for future use. What you want to use for that is rerere.

git init echo Hello > Hello.txt git add Hello.txt git commit -m "Create Hello.txt (commit A)" git tag start echo World! >> Hello.txt git commit -am "Change to Hello World (commit B)" git checkout start git checkout -b branch echo Dave >> Hello.txt git commit -am "Change to Hello Dave (commit C)" 
git merge master 
echo "Hello World, Dave!" > Hello.txt git add Hello.txt git commit -m "Merge branch master into branch (commit D)" 
git checkout start git checkout -b goodbye-branch echo Goodbye > Goodbye.txt git add Goodbye.txt git commit -m "Add Goodbye.txt (commit E)" 
git checkout branch git rebase -p goodbye-branch 
git config --global rerere.enabled true 

TL; DR

The --preserve-merges flag simply tells git-rebase to try to recreate merge commits instead of ignoring them. It does not give git rebase the ability to remember how merge conflicts were resolved, i.e. it does not record conflict resolutions for future use. What you want to use for that is rerere.

git init echo Hello > Hello.txt git add Hello.txt git commit -m "Create Hello.txt (commit A)" git tag start echo World! >> Hello.txt git commit -am "Change to Hello World (commit B)" git checkout start git checkout -b branch echo Dave >> Hello.txt git commit -am "Change to Hello Dave (commit C)" 
git merge master 
echo "Hello World, Dave!" > Hello.txt git add Hello.txt git commit -m "Merge branch master into branch (commit D)" 
git checkout start git checkout -b goodbye-branch echo Goodbye > Goodbye.txt git add Goodbye.txt git commit -m "Add Goodbye.txt (commit E)" 
git checkout branch git rebase -p goodbye-branch 
git config --global rerere.enabled true 
clarification
Source Link
jub0bs
  • 67.3k
  • 27
  • 198
  • 200
Loading
add other cases
Source Link
jub0bs
  • 67.3k
  • 27
  • 198
  • 200
Loading
added details about --preserve-merges flag
Source Link
jub0bs
  • 67.3k
  • 27
  • 198
  • 200
Loading
more details on rerere
Source Link
jub0bs
  • 67.3k
  • 27
  • 198
  • 200
Loading
added better graphs
Source Link
jub0bs
  • 67.3k
  • 27
  • 198
  • 200
Loading
deleted 24 characters in body
Source Link
jub0bs
  • 67.3k
  • 27
  • 198
  • 200
Loading
added 2211 characters in body
Source Link
jub0bs
  • 67.3k
  • 27
  • 198
  • 200
Loading
added 2211 characters in body
Source Link
jub0bs
  • 67.3k
  • 27
  • 198
  • 200
Loading
added 141 characters in body
Source Link
jub0bs
  • 67.3k
  • 27
  • 198
  • 200
Loading
deleted 1 character in body
Source Link
jub0bs
  • 67.3k
  • 27
  • 198
  • 200
Loading
added 27 characters in body
Source Link
jub0bs
  • 67.3k
  • 27
  • 198
  • 200
Loading
Source Link
jub0bs
  • 67.3k
  • 27
  • 198
  • 200
Loading