• 0 Posts
  • 2 Comments
Joined 3 days ago
cake
Cake day: April 4th, 2026

help-circle

  • The replies so far aren’t wrong, but there’s probably a more fundamental issue here.

    Your risk of conflicts increases as you add more clones, add more working copies, add more collaborators. It usually decreases if folks regularly push their changes, regularly pull others’ changes, and get out of each others’ way by judiciously using branches and merging the branches back in when the work necessitating that branch is completed.

    We use these materials to teach scientists and engineers about Git, and the specific section on resolving conflicts is here. We don’t cover branching since we only have a couple hours total.

    The workflow we try to drill into the students starts out as:

    1. Make changes.
    2. Run git add and/or git rm to set what will be committed.
    3. Run git commit to commit those changes.
    4. Repeat from 1.

    Nobody ever gets conflicts at this stage because there’s only one working copy and one repository per student. No remotes, no collaborators, no extra clones.

    Then we bring in remotes. This changes the workflow to:

    1. Make changes.
    2. Add/rm.
    3. Commit.
    4. Push.
    5. Repeat.

    Still no conflicts as long as there’s only one working copy, one local repository, and one remote that’s basically a push-only copy of the local repo.

    Then we add a collaborator and the workflow changes to:

    1. Pull.
    2. Make changes.
    3. Add/rm.
    4. Commit.
    5. Push.
    6. Repeat.

    Still no conflicts as long as only one person at a time is working, and as long as each person does all the steps, including the pull.

    The conflicts section starts with one or more collaborators omitting the pull step, making concurrent changes to the same part of a file, and pushing.

    That’s all that’s required to cause a conflict, and it gets technically resolved by the later pusher editing the files to remove the conflict punctuation, making a new local commit with those changes, and pushing. Git itself doesn’t care if it’s the “correct” set of changes, only that the conflict punctuation is removed.