From the documentation of git rebase:
The current branch is reset to , or if the --onto option was supplied. This has the exact same effect as git reset --hard (or ). ORIG_HEAD is set to point at the tip of the branch before the reset.
The commits that were previously saved into the temporary area are then reapplied to the current branch, one by one, in order. Note that any commits in HEAD which introduce the same textual changes as a commit in HEAD.. are omitted (i.e., a patch already accepted upstream with a different commit message or timestamp will be skipped).
Then the important bit:
It is possible that a merge failure will prevent this process from being completely automatic
I can see how that happens in general, but I have a case were it seems to have happened oddly.
Here are my commands:
407 07/09/18 16:53:09 cd temp
408 07/09/18 16:53:16 git clone https://github.com/joereddington/todo.txt
410 07/09/18 16:53:35 cd todo.txt/
412 07/09/18 16:53:41 git rebase HEAD~20
I feel like this CAN'T possibly fail. My understanding is that the sequence is:
- Move HEAD to HEAD~20
- Put the 20 most recent commits into a tempory area
- in order, reapply commits that have already been done to a repo that has the same state
- End
But I get an error:
Applying: update Using index info to reconstruct a base tree... M todo.txt .git/rebase-apply/patch:21: trailing whitespace. (A) Apply for gift aid number .git/rebase-apply/patch:30: trailing whitespace. (C) Sort all the 'to sort' spending in the right categories in the expenditure against grant file. .git/rebase-apply/patch:76: trailing whitespace. (E) Go thought calendar and find at least one 'thank you's you *can* make warning: 3 lines add whitespace errors. Falling back to patching base and 3-way merge... Auto-merging todo.txt CONFLICT (content): Merge conflict in todo.txt error: Failed to merge in the changes. Patch failed at 0025 update The copy of the patch that failed is found in: .git/rebase-apply/patch
Resolve all conflicts manually, mark them as resolved with "git add/rm <conflicted_files>", then run "git rebase --continue". You can instead skip this commit: run "git rebase --skip". To abort and get back to the state before "git rebase", run "git rebase --abort".
Josephs-Mini:todo.txt josephreddington$
How can this happen? It's refusing to execute a commit on content that it has already executed the same changes on!