this post was submitted on 04 Apr 2026
14 points (79.2% liked)
Learn Programming
2153 readers
1 users here now
Posting Etiquette
-
Ask the main part of your question in the title. This should be concise but informative.
-
Provide everything up front. Don't make people fish for more details in the comments. Provide background information and examples.
-
Be present for follow up questions. Don't ask for help and run away. Stick around to answer questions and provide more details.
-
Ask about the problem you're trying to solve. Don't focus too much on debugging your exact solution, as you may be going down the wrong path. Include as much information as you can about what you ultimately are trying to achieve. See more on this here: https://xyproblem.info/
Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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:
git addand/orgit rmto set what will be committed.git committo commit those changes.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:
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:
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.
The post was getting long enough already, but see the end of the conflicts section for several things you can do to reduce the likelihood of conflicts. Some are technical, others are more about communication and management.