gitgithubvisual-studio-codegit-amend

Can I amend a commit made with VSCode to GitHub repo?


I learn Git and Using VSCode and just learn the commit "amend" command and now trying it on origin (GitHub).

I can't find any way to do this. Do I need some external tool to do that I don't see any "push amend" from the Git menu in VSCode


Solution

  • You do not push amend to the remote repo. git commit --amend allows you to include all current staged changes to your last commit in the local repo, instead of creating a new commit.

    Let say you committed all changes but forgot to include a file include_me.js. You may run git add include_me.js, then git commit --amend to amend your last commit.

    As mentioned by knittl, if you amend an already-pushed commit, you have to force-push the branch. Beware, if anyone has pulled the branch before you force push, they will have to reset their local branch.