If you launch VSCode while git is in your PATH (%PATH% on Windows, $PATH onLinux/Mac), then the Version Control feature will be active, and you will be able to commit/push when working in a folder with a .git/ subfolder inside (one created by git clone, or initialized with git init)
I like adding GitLens for more git-related features, making the push even easier.
Answer from VonC on Stack OverflowHow do you push and commit to git directly from VS code - Stack Overflow
How to git push to a different branch with Visual Studio Code? - Stack Overflow
Committing and pushing from vscode instead of GitHub Desktop
Using github and VS Code?
Update 2022-12-27
On the Source Control tab (Ctrl+⇧+G or ^+⌘+G on Mac), press ⃛ to access Git commands dropdown menu:
Switch to the branch to push – Branch > Create Branch OR Checkout to... > Create New Branch

Press the Commit & Push button (if not visible, press ⌄ under the Message text box)
two popups will show up for you to confirm staging, committing and pushing of your changes to this new branch

Alternative using only menu options:
- Switch to the branch to push – Branch > Create Branch OR Checkout to... > Create New Branch
- Stage your changes – button above the files list OR Changes > Stage All Changes (several Git: options available)
- Commit your changes – ✓ top left button OR Commit
- Push the new branch: Branch > Publish Branch (or just use the Push option and press OK in the popup)
All above options can be accessed through commands F1 (Mac: fn+F1 or ⇧+⌘+P) and typing git [command], e.g. "git checkout".
For previous versions, check this answer's timeline.
git push an existing project to GitHub git init git add . git commit -m "Add existing project files to Git" git remote add origin https://github.com/cameronmcnz/example-website.git git push -u -f origin master
Not sure if this belongs in r/github r/git or r/vscode.
I have recently started using GitHub desktop to commit and push my projects to GitHub from vscode, to be able to work on them on both my desktop and laptop. Well, I recently downloaded Git because I saw a source control tab in vscode. So I logged in to GitHub and it automatically connected to my repository. Now I get letters next to the files when I edit them. (Sorry if the terminology is wrong, I'm a noob). I thought this was great because not the commit and push button will be in vscode (I don't have to open GitHub desktop). Well when I use the button in vscode, it just keeps working. It never finishes (and I cant see any progress). So I have to close down vscode, open github desktop and commit and push from there like I used to (the commit and push take less than 5 seconds). What could be wrong with the button in vscode?
Hey everyone!
I know i’m going to sound pretty stupid for this but i’ve looked all over youtube and all of the videos are from years ago or don’t really explain it well in my opinion. Can someone here explain to me in the most basic terms how to use github and vs code together so that i’m able to access my code from both my laptop and desktop
update: thank you so much everyone! i was able to figure it out
There is a button at the bottom left of the VS Code editor, which you can click to automatically sync your branch with that from remote (i.e. both pull AND push, merging your branch with upstream if necessary). This might or might not be what you want, but it's easy to click this when you know that there are no changes upstream (e.g. when you're working on a project by yourself).

Otherwise, I frequently bring up the Command Palette with ⇧⌘P (Ctrl-Shift-P on Windows/Linux) and type gpus, which brings up Git: Push as the first option. (It's been ingrained in my fingers since the days of Sublime Text)
If you are using the later versions of VS Code which has MRU list of command history, you can shorten it even further and just type gp, which is exactly what I've been using since SublimeGit in Sublime Text.

Lastly, another option you may want is to add a custom keyboard shortcut to push changes. You can do this by editing your Keyboard Shortcuts File, and adding something like the following:
{
{
"key": "ctrl+alt+p",
"command": "git.push"
}
}
There is a new setting Post Commit Command in vscode 1.30.1 to change the default commit behavior:
