Working with conflicting changes
There are cases where two users are editing the same files and
when the second to commit to the repository tries to commit their changes, the
repository won't allow the commit to succeed because of the conflict. Let's
simulate this by making Fred and Jane change the same files.
- In Fred's workspace open one of the navigation views and edit
file1.txt. Make the text the following:
Fred line 1
This is the contents
Fred-update
of file 1.
- Fred will also change file2.txt with the following change:
File2 is a (Fred was here again)
with simple text.
- Fred committed his changes to the repository.
- Next, at the same time Jane was making changes to file1.txt. She
added the following line to the end of the file:
This is the contents
Fred-update
of file 1.
Jane was at the end
- And finally, Jane changed file2.txt to the following:
File2 is a (Jane was here) small file
with simple text.
- When Jane was finished making changes she synchronized the
project and found the following appear in the Synchronize View:
- Both file1.txt and file2.txt
show with a red icon indicating that they have
conflicting changes. You can't commit the files until the conflicts are resolved.
Click on file1.txt and notice that Fred and Jane made changes to two different
parts of the file. In this case, Jane can simply update the file and the lines
added by Fred will be merged into Jane's local file. Select file1.txt and
from the context menu select Update.
- Next, double on file2.txt to see the conflict. In this case you can see
that both Jane and Fred changed the same line. For this type of conflicting
change a regular update can't resolve the conflict. Here you have three options
(with the command to use in brackets): accept the changes from Fred (Override
and Update), ignore Fred's changes (Mark
as Merged), or manually merge the files within the compare editor.
- For this example, let's say Jane updated file1.txt and selected
override and update for file2.txt. After the operations are run the
conflicts turn into outgoing changes. Jane can review the changes and
commit them.