@@ -94,12 +94,6 @@ You should have already :ref:`set up your system <setup>`,
9494
9595 git push origin <branch-name>
9696
97- * If someone else added new changesets and you get an error::
98-
99- git fetch upstream
100- git merge upstream/master
101- git push origin <branch-name>
102-
10397* Finally go on :samp: `https://github.com/{ <your-username> } /cpython `: you will
10498 see a box with the branch you just pushed and a green button that allows
10599 you to create a pull request against the official CPython repository.
@@ -114,6 +108,21 @@ You should have already :ref:`set up your system <setup>`,
114108 git commit -m '<message>'
115109 git push origin <branch-name>
116110
111+ * If someone else added new changesets and you get an error::
112+
113+ git checkout <branch-name>
114+ git pull origin <branch-name> # pull = fetch + merge
115+ # if there are merge conflicts: see "Resolving Merge Conflicts" below
116+ git push origin <branch-name>
117+
118+ * If time passes and there are merge conflicts with the master branch, merge
119+ the changes from the master branch while resolving the conflicts locally::
120+
121+ git checkout <branch-name>
122+ git pull upstream master # pull = fetch + merge
123+ # resolve conflicts: see "Resolving Merge Conflicts" below
124+ git push origin <branch-name>
125+
117126* After your PR has been accepted and merged, you can :ref: `delete the branch
118127 <deleting_branches>`::
119128
@@ -125,6 +134,35 @@ You should have already :ref:`set up your system <setup>`,
125134 workflow is **strongly ** preferred.
126135
127136
137+ .. _resolving-merge-conflicts :
138+
139+ Resolving Merge Conflicts
140+ '''''''''''''''''''''''''
141+
142+ When merging changes from different branches (or variants of a branch on
143+ different repos), the two branches may contain incompatible changes to one
144+ or more files. These are called "merge conflicts" and need to be manually
145+ resolved as follows:
146+
147+ #. Check which files have merge conflicts::
148+
149+ git status
150+
151+ #. Edit the affected files and bring them to their intended final state.
152+ Make sure to remove the special "conflict markers" inserted by git.
153+
154+ #. Commit the affected files::
155+
156+ git add <filenames>
157+ git merge --continue
158+
159+ When running the final command, git may open an editor for writing a commit
160+ message. It is usually okay to leave that as-is and close the editor.
161+
162+ See `the merge command's documentation <https://git-scm.com/docs/git-merge >`_
163+ for a detailed technical explanation.
164+
165+
128166.. _good-prs :
129167
130168Making Good PRs
0 commit comments