I’ve configured VS Code to follow git best practices when it comes to creating branches and merging via pull requests. Here are my notes:
Install gitlens plugin
To open the command pallet: F1 or Command Shift P
CP is short for Command Pallet for following commands.
CP : git clone
- Enter <repo URL> -> select destination
- optional: add folder to workspace (bottom right)
CP: git add remote
- select repository -> label upstream
CP: git fetch from all remotes
CP: git create branch from
- select repo -> provide name -> select upstream/master
Click on a file in the repo, verify you’re in your new branch (bottom left)
Publish branch to your repo:
CP: git publish branch
- select repo -> origin
Make your changes
Commit your changes to your branch (git icon on the left – type commit message, optionally compare files) – hit check mark to commit
— your changes are committed to your personal repo branch —
Log into gitlab, go to repo, click Compare & pull request
If you ever need to remove upstream URL:
CP: git remove remote