@@ -17,12 +17,12 @@ $ gh pr checkout {PR_ID}
17
17
Now, run a symmetric diff against the base branch:
18
18
19
19
``` vim
20
- :DiffviewOpen origin/main ...HEAD --imply-local
20
+ :DiffviewOpen origin/HEAD ...HEAD --imply-local
21
21
```
22
22
23
23
The symmetric difference rev range (triple dot) will here compare the changes on
24
- the current branch (the PR branch) against its merge-base in ` origin/main ` . This
25
- is different than comparing directly against ` origin/main ` if the branches have
24
+ the current branch (the PR branch) against its merge-base in ` origin/HEAD ` . This
25
+ is different from comparing directly against ` origin/HEAD ` if the branches have
26
26
diverged, and is usually what you want when comparing changes in a PR. For more
27
27
info see the section on "SPECIFYING REVISIONS" in ` man git-rev-parse(1) ` .
28
28
@@ -47,6 +47,15 @@ involved.
47
47
48
48
![ diffview symdiff demo] ( https://user-images.githubusercontent.com/2786478/229858634-c751ebe3-cc43-48de-adda-bf0b71fa2ce7.png )
49
49
50
+ > NOTE: If Git complains ` fatal: Not a valid object name origin/HEAD ` then it
51
+ > likely means that your local origin remote doesn't have a default branch
52
+ > configured. You can have Git automatically query your remote and detect its
53
+ > default branch like this:
54
+ >
55
+ > ``` sh
56
+ > git remote set-head -a origin
57
+ > ` ` `
58
+
50
59
[^1]: The files as they currently exist on disk.
51
60
52
61
# ## Comparing Changes From the Individual PR Commits
@@ -56,13 +65,13 @@ review the changes introduced in each of those commits individually. To do
56
65
this, you can use `:DiffviewFileHistory`:
57
66
58
67
```vim
59
- :DiffviewFileHistory --range=origin/main ...HEAD --right-only --no-merges
68
+ :DiffviewFileHistory --range=origin/HEAD ...HEAD --right-only --no-merges
60
69
```
61
70
62
71
Here we are again using a symmetric difference range. However, symdiff ranges
63
72
have different behavior between `git-diff` and `git-log`. Whereas in `git-diff`
64
73
it compares against the merge-base, here it will select only the commits that
65
- are reachable from * either * ` origin/main ` * or * ` HEAD ` , but not from both (in
74
+ are reachable from _either_ `origin/HEAD` _or_ `HEAD`, but not from both (in
66
75
other words, it' s actually performing a symmetric difference here).
67
76
68
77
We then use the cherry-pick option ` --right-only` to limit the commits to only
@@ -80,7 +89,7 @@ create a new commit from within the editor:
80
89
81
90
# ## Use a Git Wrapper Plugin (Recommended)
82
91
83
- Diffview.nvim * is not * , and * does not try to be * a complete git wrapper. As
92
+ Diffview.nvim _is not_ , and _does not try to be_ a complete git wrapper. As
84
93
such, there are a number of features offered by such plugins that won' t ever be
85
94
implemented here, because they are deemed out-of-scope. It' s therefore
86
95
recommended to use some form of a Git wrapper plugin in order to get a more
0 commit comments