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

30.8k Views Asked by At

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

2

There are 2 best solutions below

1
On BEST ANSWER

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.

3
On

You can go to Commit -> choose Commit All(Amend) or Commit Staged(Amend). Take a look at the picture.

enter image description here