Skip to content

Commit

Permalink
Suggest using git range-diff
Browse files Browse the repository at this point in the history
I have found it to be very helpful when rebasing.
  • Loading branch information
camelid committed Mar 25, 2021
1 parent 9a676ee commit 9648401
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/git.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ there are no glaring errors.
Once you're all done fixing the conflicts, you need to stage the files that had
conflicts in them via `git add`. Afterwards, run `git rebase --continue` to let
Git know that you've resolved the conflicts and it should finish the rebase.

Once the rebase has succeeded, you'll want to update the associated branch on
your fork with `git push --force-with-lease`.

Expand Down Expand Up @@ -263,6 +264,26 @@ You also may want to squash just the last few commits together, possibly
because they only represent "fixups" and not real changes. For example,
`git rebase --interactive HEAD~2` will allow you to edit the two commits only.

### `git range-diff`

After completing a complicated rebase, or even a relatively simple one, you may
want to review the changes between your old branch and your new one. You can do
that with the `git range-diff master @{u} HEAD` command, which can be very
helpful when you had a complicated rebase and you want to make sure you changed
the right things.

Unlike in regular Git diffs, you'll see a `-` or `+` next to another `-` or `+`
in the range-diff output. The marker on the left indicates a change between the
old branch and the new branch, and the marker on the right indicates a change
you've committed. So, you can think of a range-diff as a "diff of diffs" since
it shows you the differences between your old diff and your new diff.

`git range-diff` is a very useful command, but note that it can take some time
to get used to its output format. You may also find Git's documentation on the
command useful, especially [their "Examples" section][range-diff-example-docs].

[range-diff-example-docs]: https://git-scm.com/docs/git-range-diff#_examples

## No-Merge Policy

The rust-lang/rust repo uses what is known as a "rebase workflow." This means
Expand Down

0 comments on commit 9648401

Please sign in to comment.