@@ -94,12 +94,6 @@ You should have already :ref:`set up your system <setup>`,
94
94
95
95
git push origin <branch-name>
96
96
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
-
103
97
* Finally go on :samp: `https://github.com/{ <your-username> } /cpython `: you will
104
98
see a box with the branch you just pushed and a green button that allows
105
99
you to create a pull request against the official CPython repository.
@@ -114,6 +108,24 @@ You should have already :ref:`set up your system <setup>`,
114
108
git commit -m '<message>'
115
109
git push origin <branch-name>
116
110
111
+ * If a core developer reviewing your PR pushed one or more commits to your
112
+ PR branch, then after checking out your branch and before editing, run::
113
+
114
+ git pull origin <branch-name> # pull = fetch + merge
115
+
116
+ If you have made local changes that have not been pushed to your fork and
117
+ there are merge conflicts, git will warn you about this and enter conflict
118
+ resolution mode. See :ref: `resolving-merge-conflicts ` below.
119
+
120
+ * If time passes and there are merge conflicts with the master branch, GitHub
121
+ will show a warning to this end and you may be asked to address this. Merge
122
+ the changes from the master branch while resolving the conflicts locally::
123
+
124
+ git checkout <branch-name>
125
+ git pull upstream master # pull = fetch + merge
126
+ # resolve conflicts: see "Resolving Merge Conflicts" below
127
+ git push origin <branch-name>
128
+
117
129
* After your PR has been accepted and merged, you can :ref: `delete the branch
118
130
<deleting_branches>`::
119
131
@@ -125,6 +137,35 @@ You should have already :ref:`set up your system <setup>`,
125
137
workflow is **strongly ** preferred.
126
138
127
139
140
+ .. _resolving-merge-conflicts :
141
+
142
+ Resolving Merge Conflicts
143
+ '''''''''''''''''''''''''
144
+
145
+ When merging changes from different branches (or variants of a branch on
146
+ different repos), the two branches may contain incompatible changes to one
147
+ or more files. These are called "merge conflicts" and need to be manually
148
+ resolved as follows:
149
+
150
+ #. Check which files have merge conflicts::
151
+
152
+ git status
153
+
154
+ #. Edit the affected files and bring them to their intended final state.
155
+ Make sure to remove the special "conflict markers" inserted by git.
156
+
157
+ #. Commit the affected files::
158
+
159
+ git add <filenames>
160
+ git merge --continue
161
+
162
+ When running the final command, git may open an editor for writing a commit
163
+ message. It is usually okay to leave that as-is and close the editor.
164
+
165
+ See `the merge command's documentation <https://git-scm.com/docs/git-merge >`_
166
+ for a detailed technical explanation.
167
+
168
+
128
169
.. _good-prs :
129
170
130
171
Making Good PRs
0 commit comments