@@ -217,6 +217,7 @@ there are no glaring errors.
217
217
Once you're all done fixing the conflicts, you need to stage the files that had
218
218
conflicts in them via ` git add ` . Afterwards, run ` git rebase --continue ` to let
219
219
Git know that you've resolved the conflicts and it should finish the rebase.
220
+
220
221
Once the rebase has succeeded, you'll want to update the associated branch on
221
222
your fork with ` git push --force-with-lease ` .
222
223
@@ -263,6 +264,67 @@ You also may want to squash just the last few commits together, possibly
263
264
because they only represent "fixups" and not real changes. For example,
264
265
` git rebase --interactive HEAD~2 ` will allow you to edit the two commits only.
265
266
267
+ ### ` git range-diff `
268
+
269
+ After completing a complicated rebase, or even a relatively simple one, you may
270
+ want to review the changes between your old branch and your new one. You can do
271
+ that with the ` git range-diff master @{upstream} HEAD ` command, which can be
272
+ very helpful when you had a complicated rebase and you want to make sure you
273
+ changed the right things.
274
+
275
+ The first argument to ` range-diff ` , ` master ` in this case, is the base revision
276
+ that you're comparing your old and new branch against. The second argument is
277
+ the old version of your branch; in this case, ` @upstream ` means the version that
278
+ you've pushed to GitHub, which is the same as what people will see in your pull
279
+ request. Finally, the third argument to ` range-diff ` is the * new* version of
280
+ your branch; in this case, it is ` HEAD ` , which is the commit that is currently
281
+ checked-out in your local repo.
282
+
283
+ Note that you can also use the equivalent, abbreviated form `git range-diff
284
+ master @{u} HEAD`.
285
+
286
+ Unlike in regular Git diffs, you'll see a ` - ` or ` + ` next to another ` - ` or ` + `
287
+ in the range-diff output. The marker on the left indicates a change between the
288
+ old branch and the new branch, and the marker on the right indicates a change
289
+ you've committed. So, you can think of a range-diff as a "diff of diffs" since
290
+ it shows you the differences between your old diff and your new diff.
291
+
292
+ Here's an example of ` git range-diff ` output (taken from [ Git's
293
+ docs] [ range-diff-example-docs ] ):
294
+
295
+ ```
296
+ -: ------- > 1: 0ddba11 Prepare for the inevitable!
297
+ 1: c0debee = 2: cab005e Add a helpful message at the start
298
+ 2: f00dbal ! 3: decafe1 Describe a bug
299
+ @@ -1,3 +1,3 @@
300
+ Author: A U Thor <author@example.com>
301
+
302
+ -TODO: Describe a bug
303
+ +Describe a bug
304
+ @@ -324,5 +324,6
305
+ This is expected.
306
+
307
+ -+What is unexpected is that it will also crash.
308
+ ++Unexpectedly, it also crashes. This is a bug, and the jury is
309
+ ++still out there how to fix it best. See ticket #314 for details.
310
+
311
+ Contact
312
+ 3: bedead < -: ------- TO-UNDO
313
+ ```
314
+
315
+ (Note that ` git range-diff ` output in your terminal will probably be easier to
316
+ read than in this example because it will have colors.)
317
+
318
+ Another feature of ` git range-diff ` is that, unlike ` git diff ` , it will also
319
+ diff commit messages. This feature can be useful when amending several commit
320
+ messages so you can make sure you changed the right parts.
321
+
322
+ ` git range-diff ` is a very useful command, but note that it can take some time
323
+ to get used to its output format. You may also find Git's documentation on the
324
+ command useful, especially their [ "Examples" section] [ range-diff-example-docs ] .
325
+
326
+ [ range-diff-example-docs ] : https://git-scm.com/docs/git-range-diff#_examples
327
+
266
328
## No-Merge Policy
267
329
268
330
The rust-lang/rust repo uses what is known as a "rebase workflow." This means
0 commit comments