Skip to main content

Differences Between VS Code and Jupyter Lab When Using Git

Inside the Processing and Intelligence modules, you can use both VS Code (see the setup guides here) and Jupyter Lab, which is native to the modules. However, there are restrictions when using Git from inside VS Code.

What works in VS Code?​

In VS Code, you can run local Git commands, meaning commands that do not require communication with the remote repository.

git log                 # View commit history
git status # Check the working tree status
git add nome-do-arquivo # Add files to staging
git checkout -b nova-branch # Create and switch to a new branch

πŸ“Œ These commands work because they do not depend on the remote repository.

What does NOT work in VS Code?​

Commands that require interaction with the remote repository (GitHub, GitLab, and so on) do not work in VS Code.

Examples of commands that do not work:

git pull origin main       # Pull changes from the remote repository
git commit -m "DOCS: This commit will not work in VS Code" # Create a commit
git push origin minha-branch # Push changes to GitHub

Where should you run remote commands (commit, pull, push)?​

For commands that involve the remote repository, use the Jupyter Lab terminal:

git pull origin main # fetch updates from main
git commit -m "Adding new feature"
git push origin minha-nova-branch # push the new branch to the repository

πŸ“˜ Summary

πŸ”Ή To view history, check status, and stage files, you can use VS Code.

πŸ”Ή To run commit, pull, and push, use the Jupyter Lab terminal.

CommandWorks in VS Code?Works in Jupyter Lab?
git logβœ… Yesβœ… Yes
git statusβœ… Yesβœ… Yes
git add nome-arquivoβœ… Yesβœ… Yes
git checkout -b branchβœ… Yesβœ… Yes
git commit -m "msg"❌ Noβœ… Yes
git pull❌ Noβœ… Yes
git push❌ Noβœ… Yes

πŸ’‘ You can also work exclusively in Jupyter Lab if that is your preferred workflow.

πŸ’‘ And remember that VS Code supports many extensions that can add significant value to your development environment.