External Sync / How to... / Resolving conflicts / Simultaneous Modification of a Template / Different areas (disjunction)
Simultaneous changes to a template, different areas (disjunction)
Table of contents |
This scenario demonstrates the approach for handling conflicts where multiple developers working on a template at the same time leads to different changes being made to the local working versions of the template.
When conflicting changes are made at different points in the same file, the conflict is rectified outside of FirstSpirit by transferring the local changes to the Git repository from Git client using merge.
Initial situation
The FirstSpirit project includes a page template page_text, whose presentation channel definition “HTML” contains the following text:
Line 1
Line 2
Line 3
Line 4
Line 5
The version of the page template is the same in both developers’ project instances.
How the conflict occurs
Developer A
- Modifying a FirstSpirit element
Developer A changes the content of the presentation channel in the page template page_text
Line 1
Line 2 A
Line 3
Line 4
Line 5 - Exporting changes into the file system
Developer A uses fs-cli to export the current version of the project into the local file system (Git repository)
fs-cli -p DevProject -sd "D:\Git\DevProject" export templatestore - Transferring changes to the Git repository
Developer A transfers the changes to the Git repository
git commit -a -m "changed page_text"
git push
Developer B
- Modifying a FirstSpirit element
The content of the presentation channel changes at a different point to Developer A
Line 1
Line 2
Line 3
Line 4 B
Line 5 - Exporting changes into the file system
Developer B uses fs-cli to export the current version of the project into the local file system (Git repository)
fs-cli -p DevProject -sd "D:\Git\DevProject" export templatestore¶ - Transferring changes to the Git repository
Developer B transfers the changes to the Git repository
git commit -a -m "export page_text"
git push
He receives the following log report:
$ git push
To ssh://firstspirit.example/externalsync
! [rejected] myBranch -> ts/sync-test (non-fast-forward)
error: failed to push some refs to 'ssh://fsgit@ssh://test.domain.com/git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
This report shows that a conflict has occurred: The repository contains another change at another point in the file to be checked in (the change made by Developer A) and this change is not in the local version (from Project B).
Conflict resolution
Update
In this case, this conflict can be resolved automatically using the Git client.
Updating the local Git repository
Developer B performs an update of the project data against the Git repository
git pull
During the pull process, the Git client automatically performs a merge. Message from the Git client in the command line, e.g.:
Auto-merging TemplateStore/PageTemplates/page_text/ChannelSource_HTML_html.html
Merge made by the 'recursive' strategy.
Import
Developer B should now check the result of the completed Auto-Merge and then transfer the changes to the page template in the repository.
Importing the contents from the file system to the FirstSpirit project
Developer B
fs-cli -p DevProject -sd "D:\Git\DevProject" import
After the import, Developer B should conduct a technical check of the results.
Export
Exporting changes into the file system
Developer B uses fs-cli to export the current version of the project into the local file system
fs-cli -p DevProject -sd "D:\Git\DevProject" export templatestore
Commit / Push
Transferring changes to the Git repository
Developer B transfers the changes to the Git repository
git push
Next steps
The conflict is resolved. Developer B does not have to do anything else at this point.
Developer A
If Developer A restarts development work later on, then he should complete the following:
- Updating the local Git repository
Developer A
Update the local working version so that it is in line with the repository:
git pull - Importing the contents from the file system to the FirstSpirit project
Developer A
fs-cli -p DevProject -sd "D:\Git\DevProject" import
The page template page_text in the merged version of the presentation channel definition is now in both Developer A’s local project and Developer B’s local project
Line 1
Line 2 A
Line 3
Line 4 B
Line 5