# Which repository for group work?

## Definition

The most commonly used repository for storing computer files is the folder, or directory. While this is perfectly suited for managing files by a single user on their local hard drive, it quickly shows limitations for collaborative work — as detailed in [shared network directories](https://docs.redaction-technique.org/en/tech-writing-process/shared-network-directories/).

> **Caution: The last save wins**
>
> Programs do not support concurrent modification of the same file by multiple technical writers. When two writers edit the same file and nothing locks it, whoever saves last erases the other's changes.

## The situation: two writers, one file

Let's imagine that Alice and Bob open the same version of a file, available on a network drive, in a text editor:

1. Alice and Bob each open the same version of the file.
2. They each make different changes to the copy loaded in RAM.
3. Alice saves her changes first, then Bob.
4. The next time the file is opened, only Bob's changes appear in the file.

> **Diagram: Concurrent edits to a file on a shared network drive**
>
> Sequence diagram showing Alice and Bob opening the same version of a file, each editing their own copy, then saving one after the other: Alice's changes, saved first, are overwritten by Bob's.

**Concurrent edits: Bob's changes overwrite Alice's.**

## Why it happens

To work on a file, the technical writer uses an application that reads the file from their hard drive and loads a copy into RAM. Modifications are made on this copy. When the technical writer saves their changes, the program overwrites the previous version of the file on the hard drive.

The previous version is therefore permanently deleted unless:

- **the program has created a backup copy.** There are then only two versions of the file at any given time: version n and version n-1.
- **the technical writer uses *Save As*, not *Save*,** to create a new version of the file. The technical writer can then create as many versions as needed, for example by adding the suffix -1, -2, etc., to the file name.

## Possible approaches and their consequences

Lock open files
: To prevent overwrites, many programs lock open files. They are only available for reading as long as the user modifying them has a copy open in RAM (i.e., until they close it). It is therefore not possible with this system to allow multiple users to work on the same file and make batch modifications across files, such as changing the path of all images.

Do not lock files
: If the program used does not lock open files, constant coordination is required between team members.

Use a version management system
: [Version management systems](https://docs.redaction-technique.org/en/tech-writing-process/version-control-systems/) address these limitations reliably.

## Next steps

- To see the other risks of working directly on a network share, read [shared network directories](https://docs.redaction-technique.org/en/tech-writing-process/shared-network-directories/).
- To see how a version management system stores changes as content rather than files, read [Git: from file to content](https://docs.redaction-technique.org/en/tech-writing-process/git-from-file-to-content/).
- To see how a CMS manages file locking for the team, read [CMS: workflow as a bonus, but reliability to be tested](https://docs.redaction-technique.org/en/tech-writing-process/cms-workflow-and-reliability/).
- To compare all the kinds of repository, go back to [Repository](https://docs.redaction-technique.org/en/tech-writing-process/repository/).

---

Source: https://docs.redaction-technique.org/en/tech-writing-process/which-repository-for-group-work/
