Do reviews in VSCode comparing branches using its native git source control view.
Example:
main
│
│
┌───x main_ancestor
│ │
│ ▼
branch_commit1 x x main_newcommit
│
▼
branch_commit2 x
As in GitHub pull requests, the branch is compared to main before new commits were added to it (main_ancestor). Said differently, all changes from main_ancestor to branch_commit2 are shown (branch_commit1 + branch_commit2 changes).
Features
Two commands are available:
reviews.compare: compare a branch to a base branch. Enter the parameter <branch>..<base_branch>, ex. fix/typo..develop, branchcan be omitted and will default on the current branch,base_branch can be ommitted and will default to main. This command:
fetch and update the two branches (if a remote exists)
find the branches common ancestor (main_ancestor)
reset --soft the branch to the common ancestor
switch to the VSCode source control view
The command also stores the branch last commit (branch_commit2) workspace wise so you can come back to it using the reset command described below.
reviews.reset: reset the comparison. Comes back to the branch last commit.
Dev
Runyarn watch, then hit F5. It will open a new VSCode windows with the extension installed. Make any git repo and open it to try the extension.
More info in this file.
Look a PUBLISHING.md to publish a new version.
Release Notes
0.2.0
Reset branch prior to comparing.
Fix a bug where when comparing twice then resetting, the --hard reset was done on main and thus the commits of the branch added to main.