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 two branches. You need to provide the branch name you want to compare with main. If you don't the current branch will be used. This command:
fetch the two branches last changes (if a remote exists, otherwise the local branch is used)
find the branches common ancestor (main_ancestor)
reset --soft the branch to the common ancestor in detached HEAD mode (you can't mess your history there).
switch to the VSCode source control view
If you want to compare with another branch than main, you can type {branchName}..{anotherBranchThanMain}, ex. fix/typo..develop. You can also use the syntax ..dev if you want to compare the current branch with the dev branch.
The command stores the branchName so you can switch back to it later with the reset command.
reviews.reset: comes back to the branch state previous to the comparison, and go out of the detached HEAD mode.
Release Notes
0.3.2
short commit displayed are now consistently of length 8 everywhere
add MIT licence
exclude some file from final extension package
0.3.0
Using detached HEAD mode to prevent polluting the repository state.
..dev syntax to quickly change the base branch is now possible
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.