Ecco l'affare. master ha un file, file1. I branch, ed elimina quel file nel ramo. Nel frattempo, modifico file1 su master. Boom, conflitto.C'è un modo per far funzionare git rerere quando la risoluzione è cancellare il file in conflitto?
Quando unisco il mio ramo in master, la risoluzione è eliminare il file. Sto cercando di utilizzare git rerere
per poter eseguire la stessa risoluzione più volte, ma come puoi vedere di seguito non registra la risoluzione nel caso in cui stai cancellando il file.
Non riesco a trovare documenti specifici su questo, è solo una limitazione di rerere
?
|system| brad-macbook-air in ~/tmp
± bb+ih |master ✓| → touch file1.txt
|system| brad-macbook-air in ~/tmp
± bb+ih |master ✗| → git add . && git commit -m 'File1'
[master (root-commit) 95a807e] File1
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 file1.txt
|system| brad-macbook-air in ~/tmp
± bb+ih |master ✓| → git checkout -b delete_file_1
Switched to a new branch 'delete_file_1'
|system| brad-macbook-air in ~/tmp
± bb+ih |delete_file_1 ✓| → git rm file1.txt
rm 'file1.txt'
|system| brad-macbook-air in ~/tmp
± bb+ih |delete_file_1 ✗| → git commit -m 'rm file1'
[delete_file_1 83d1a57] rm file1
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 file1.txt
|system| brad-macbook-air in ~/tmp
± bb+ih |delete_file_1 ✓| → git checkout master
Switched to branch 'master'
|system| brad-macbook-air in ~/tmp
± bb+ih |master ✓| → echo 'hello' > file1.txt
|system| brad-macbook-air in ~/tmp
± bb+ih |master ✗| → git commit -am 'update file1'
[master 16f6541] update file1
1 file changed, 1 insertion(+)
|system| brad-macbook-air in ~/tmp
± bb+ih |master ✓| → git merge delete_file_1
CONFLICT (modify/delete): file1.txt deleted in delete_file_1 and modified in HEAD. Version HEAD of file1.txt left in tree.
Automatic merge failed; fix conflicts and then commit the result.
|system| brad-macbook-air in ~/tmp
± bb+ih |master ✗| → git rm file1.txt
file1.txt: needs merge
rm 'file1.txt'
|system| brad-macbook-air in ~/tmp
± bb+ih |master ✗| → git commit --no-edit
[master 4791204] Merge branch 'delete_file_1'
Qui dovremmo vedere qualcosa del tipo "risoluzione registrata per file1.txt", ma non è così. Giusto per essere sicuri che non sta registrando la nostra risoluzione, noi andare avanti e fare di nuovo la stessa unione:
|system| brad-macbook-air in ~/tmp
± bb+ih |master ✓| → git reset head^
Unstaged changes after reset:
D file1.txt
|system| brad-macbook-air in ~/tmp
± bb+ih |master ✗| → git co .
|system| brad-macbook-air in ~/tmp
± bb+ih |master ✓| → git merge delete_file_1
CONFLICT (modify/delete): file1.txt deleted in delete_file_1 and modified in HEAD. Version HEAD of file1.txt left in tree.
Automatic merge failed; fix conflicts and then commit the result.
E qui si può vedere che git rerere
non ricorda la risoluzione dei conflitti (e infatti lascia in modo non corretto il file nell'albero).
Grazie a @fundoopanda. Questo è davvero un peccato, sembra una limitazione del formato di archiviazione più di ogni altra cosa inerente a ciò che rerere è destinato. La mia osservazione è che anche rerere non funziona con i file binari. Ti capita di sapere se è vero anche quello? – Brad
Tutto ciò che fa è aprire il file e cercare gli hunk che contengono questi caratteri "<", ">", "=", "|" . Quindi, No. Non sarebbe giusto dire che funziona su file binari. – fundoopanda