/ / ¿Cómo puedo hacer que git rebase se complete después de resolver conflictos? Git, git-rebase, git-conflict-resolution

¿Cómo puedo obtener git rebase para completar después de resolver conflictos? Git, git-rebase, git-conflict-resolution

Acabo de intentar reajustar algunos cambios que estoy enviando a un repositorio remoto, y no puedo completarlos después de resolver los conflictos. Intenté reajustar de la siguiente manera:

$ git rebase upstream/master
First, rewinding head to replay your work on top of it...
Applying: My Commit Message
Using index info to reconstruct a base tree...
M   dir_a/dir_b/dir_c/myfile.py
.git/rebase-apply/patch:51: trailing whitespace.

.git/rebase-apply/patch:56: trailing whitespace.

.git/rebase-apply/patch:128: trailing whitespace.

.git/rebase-apply/patch:141: trailing whitespace.

.git/rebase-apply/patch:145: trailing whitespace.

warning: squelched 3 whitespace errors
warning: 8 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging dir_a/dir_b/dir_c/myfile.py
CONFLICT (content): Merge conflict in dir_a/dir_b/dir_c/myfile.py
error: Failed to merge in the changes.
Patch failed at 0001 My Commit Message
The copy of the patch that failed is found in: .git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

Después de resolver el conflicto, realicé y realicé mis cambios:

$ git add dir_a/dir_b/dir_c/myfile.py
$ git commit dir_a/dir_b/dir_c/myfile.py -m"Fixed rebase conflicts"
[detached HEAD a5a4f3b3e] Fixed rebase conflicts
1 file changed, 193 insertions(+), 13 deletions(-)

Pero cuando intento continuar, falla.

$ git rebase --continue
Applying: My Commit Message
No changes - did you forget to use "git add"?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

Lo he intentado varias veces. A veces, con comprobaciones más detalladas de la rama en la que estoy, preparando mis resoluciones de conflicto pero sin cometerlas, y siempre vuelvo al mismo punto.

Por ejemplo, si aborto y no me comprometo antes de continuar con la rebase, veo el mismo error:

$ git rebase --abort
$ git status
On branch rebase1
nothing to commit, working tree clean

Ahora, veo (o creo que sí) el mismo resultado cuando comienzo a rebase

$ git rebase upstream/master
First, rewinding head to replay your work on top of it...
Applying: My Commit Message
Using index info to reconstruct a base tree...
M   dir_a/dir_b/dir_c/myfile.py

Falling back to patching base and 3-way merge...
Auto-merging dir_a/dir_b/dir_c/myfile.py
CONFLICT (content): Merge conflict in dir_a/dir_b/dir_c/myfile.py

error: Failed to merge in the changes.
Patch failed at 0001 My Commit Message
The copy of the patch that failed is found in: .git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

despues de arreglar el conflicto yo add y rebase con el mismo resultado:

$ git add dir_a/dir_b/dir_c/myfile.py
$ git rebase --continue
Applying: My Commit Message
Applying: My Commit Message For New Code I want to Rebase
Using index info to reconstruct a base tree...
M   dir_a/dir_b/dir_c/myfile.py
Falling back to patching base and 3-way merge...
Auto-merging dir_a/dir_b/dir_c/myfile.py
CONFLICT (content): My Commit Message
error: Failed to merge in the changes.
Patch failed at 0002 Made changes to pass flake8
The copy of the patch that failed is found in: .git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

¿Qué necesito hacer / no hacer para volver a ajustar mis cambios con éxito?

Respuestas

2 para la respuesta № 1

No debe confirmar sus cambios al resolver los conflictos de rebase. Una vez que haya terminado de editar los archivos para resolver los conflictos, agregue sus nuevos cambios (por ejemplo, git add dir_a/dir_b/dir_c/myfile.py) y terminar la rebase utilizando git rebase --continue.


0 para la respuesta № 2

Incluyo esta respuesta, porque resolvió el problema que tenía, aunque no del todo lo que dije. Cuando intenté por primera vez rebase yo si add mis archivos cambiados sin committing ellos, pero sin (crei) ninguna suerte cuando traté de git rebase --continue. Entonces traté de commit mis cambios antes de ejecutar git rebase --continue, pero todavía sin éxito.

Mi error fue no darme cuenta de que, después de solucionar un conjunto de conflictos, cuando intenté volver a rebase, podrían surgir nuevos conflictos, los cuales tendrían que ser arreglados. Cuando solucioné estos nuevos conflictos, pude exitosamente rebase