Gestione delle modifiche in conflitto

Ci sono dei casi in cui due utenti modificano gli stessi file e quando il secondo per eseguire il commit nel repository tenta di seguire il commit delle sue modifiche, il repository non lo consente a causa del conflitto. Segue una simulazione in cui Fred e Jane modificano gli stessi file.

  1. In Fred's workspace open one of the navigation views and edit file1.txt. Rendere il testo come il seguente:
    Fred line 1
    This is the contents
    Fred-update
    of file 1.
    
  2. Fred will also change file2.txt with the following change:
    File2 is a (Fred was here again)
    with simple text.
    
  3. Fred ha eseguito il commit delle sue modifiche nel repository.
  4. Next, at the same time Jane was making changes to file1.txt. Ha aggiunto la seguente riga alla fine del file:
    This is the contents
    Fred-update
    of file 1.
    Jane was at the end
    
  5. And finally, Jane changed file2.txt to the following:
    File2 is a (Jane was here) small file
    with simple text.
    
  6. When Jane was finished making changes she synchronized the project and found the following appear in the Synchronize View: Conflict shown in Synchronize view and Compare editor
  7. Both file1.txt and file2.txt show with a red icon indicating that they have conflicting changes. Non è possibile eseguire il commit dei file finché non vengono risolti i conflitti. Click on file1.txt and notice that Fred and Jane made changes to two different parts of the file. In questo caso, Jane può semplicemente aggiornare il file e le righe aggiunte da Fred verranno unite al file locale di Jane. Select file1.txt and from the context menu select Update.
  8. Next, double on file2.txt to see the conflict. In questo caso è possibile vedere che Jane e Fred hanno modificato la stessa riga. Per questo tipo di modifica in conflitto, un aggiornamento normale non riesce a risolvere il conflitto. Di seguito sono riportate tre opzioni possibili (con il comando da utilizzare in parentesi): accettare le modifiche di Fred (Sostituisci e aggiorna), ignorare le modifiche di Fred (Contrassegna come unito) o unire manualmente i file nell'editor di confronto. Compare editor showing conflict
  9. For this example, let's say Jane updated file1.txt and selected override and update for file2.txt. In seguito a queste operazioni, il conflitto si trasforma in modifiche in uscita. Jane può rivedere le modifiche ed eseguirne il commit.