Visual Studio Code - All the Git Features!!!
Visual Studio Code supports Git... like a BOSS!!!
VS Code gets Git!
Let's look at the features!
Git version control
Commit, diff, pull and push
Embrace modern workflows with the power and flexibility of Git. See changed files, diffs, and make commits right from within the editor. Connect with the entire Git universe by pulling and pushing code to any remote — GitHub, Azure Web Apps, Visual Studio Team Services, and more.
Scoped Git Services
You can open a sub-directory of a Git repository in VS Code. VS Code's Git services show all the changes within the repository, but file changes outside of the scoped directory are shaded and have a tool tip indicating the file is located outside the current workspace.
Git Status Bar Actions
There is a Synchronize action in the Status Bar, next to the branch indicator, when the current checked out branch has an upstream branch configured.
If there is no upstream branch configured and the Git repository has remotes set up, a new Publish action is enabled. This will let you publish the current branch to remote.
Commit
Staging and unstaging can be done via contextual actions in the files or by drag-and-drop.
You can type a commit message above the changes and press Ctrl+Enter (Mac: ⌘+Enter) to commit them. If there are any staged changes, only those will be committed, otherwise all changes will be committed.
Git - Undo Last Commit
There is an Undo Last Commit
action which will let you undo your previous commit, keeping the changes in the working folder.
Branches and Tags
You can create and checkout branches directly within VS code through the Command Palette. Press Ctrl+P, type git
and then press Space
. You should see the following:
If you type checkout
and press Space
again, you will see a dropdown containing all of the branches or tags in the current repository.
The git branch
command lets you quickly create a new branch. Just provide the name of your new branch and VS Code will create the branch and switch to it.
Merge Conflicts
Merge conflicts are recognized by VS Code; we try to provide useful coloring markers in the gutter to the right of the code line numbers, to help you with resolving them. The green bar markers specify lines that were added, the red arrow markers specify lines that were removed, and the blue bar markers specify lines that have been altered. Once resolved, stage the conflicting file so you can commit. Click the Git icon in the sidebar to display all the changes.
Viewing Diffs
Our Git tooling supports viewing of Diffs within VS Code. Click the file in the Git view to display a side-by-side view. This allows you to compare your current file with a previous version of it:
Remotes
Given that your repository is connected to some remote and that your checked out branch has an upstream link to a branch in that remote, VS Code offers you useful actions to push, pull and sync that branch (the latter will run a pull command followed by a push command). You can find these actions in the ...
menu.
Credential prompt
To avoid the Git action being blocked by an authentication prompt, when Git requires credentials you will see a pop-up, prompting you to enter the required credentials.
Tip: If you don’t want to always enter your credentials, consider using a credential helper.
Multi-line commit
Commit messages in VS Code supported support multiple lines of text in your commit message. (Type Ctrl+Enter to finish the commit message, or Enter to add a new line to the message.)
Multiple file selection
Multiple selection is available in the Git view, meaning you can stage/unstage or commit multiple files at the same time.
Auto fetch control
There is an action to enable/disable Git auto fetch in the dropdown menu of the Git view. This is handy if you don’t have a credential helper and don’t want to get prompted for authentication all the time.
Engineering - GitHub
The VS Code GitHub repository supports continued integration for branches and pull requests:
During this first iteration of VS Code being open source, we tuned and documented more of our development workflows:
Electron is updated to version 0.34.5. This includes a bug fix for the issue on Linux where the editor font was showing blurry on certain high DPI displays.
QUICK PICK AND INPUT - GitHub Octicons
You can validate user input, get called when an item is focused in Quick Pick, and Quick Pick now has room for additional details. Also Quick Pick now supports GitHub Octicons like the Status Bar.
More info on these features:
This blog post (that you're reading now) is reason #6 as to why you should teach Java out of Visual Studio Code:
Why should I teach Java out of Visual Studio Code instead of out of Eclipse or Netbeans?
Have a great bye! Or maybe just have a good one.
- Ninja Ed
Comments
Anonymous
February 08, 2016
When will code support a interactive git history view, something like git extentions (gitextensions.github.io) would be cool!- Anonymous
April 30, 2016
The comment has been removed
- Anonymous
Anonymous
February 09, 2016
Ryan, I'm not sure. It looks like Luis opened this one back in November: github.com/.../issues You can join their conversation here: github.com/.../68Anonymous
February 09, 2016
This blog post explains Reason #6 as to why to teach Java out of Visual Studio Code: blogs.msdn.com/.../why-should-i-teach-java-out-of-visual-studio-code-instead-of-out-of-eclipse-or-netbeans.aspxAnonymous
February 15, 2016
SEE ALSO: Computers Today (part 1 of 6) blogs.msdn.com/.../computers-today.aspx Girls in computer programming... why it matters!!! blogs.msdn.com/.../cs-spotlight-girls-in-computer-programming-why-it-matters.aspx Computational Thinking - by Jeannette Wing blogs.msdn.com/.../computational-thinking-videos-amp-papers-by-jeannette-wing.aspxAnonymous
February 27, 2016
Added: QUICK PICK AND INPUT - GitHub OcticonsAnonymous
February 28, 2016
UPDATE: Added an image for the new Octicons feature.Anonymous
November 29, 2016
Bravo, quelle phrase..., l'idГ©e excellenteAnonymous
December 12, 2016
Is there any way to compare to git branches in the same way asgit diff branchA branchB
- Anonymous
January 06, 2017
I'm not sure. You'd need to ask in GitHub. Thanks!
- Anonymous
Anonymous
June 07, 2017
VSC auto initializes a local repo. Where are those files spotlight doesn't show them. Plus when I create the repo and try to clone into it in terminal it will not. What am I doing wrong?- Anonymous
July 05, 2017
John, great questions! Please ask the VSC team on a forum. Or file an issue here: https://github.com/Microsoft/vscode/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+git+historyThanks!
- Anonymous
Anonymous
July 05, 2017
Read more about the Git features here: https://code.visualstudio.com/docs/editor/versioncontrol