0

I've pushed a commit to GitHub and then realized I did'nt wanted to commit that files I entirely want to remove that added files from git.Is that possible?

Reema
  • 13
  • 4
  • Yes it is. Does this answer your question? [How to remove file from Git history?](https://stackoverflow.com/questions/43762338/how-to-remove-file-from-git-history) – Orace Oct 20 '21 at 11:44

2 Answers2

0

You can just use git revert for that.

EDIT: I don´t know if you've managed to do it or not but if you haven't here´s another thing you can try to do:

1- Delete the file by hand from GitHub.

2- Use git rebase -i HEAD~N where N = the number of commits you want to go back and there you can delete everything you don't want to show up.

Please consider marking this as the correct answer if it helps you.

Jds Wolf
  • 13
  • 3
0

You can use git reset --soft HEAD~1 to remove your last commit. Then all added files will be again marked as modified and you could pick which files you want to add to your commit

Frendom
  • 508
  • 6
  • 24
  • It worked!Thanks,after this,I used git rm --cached which just removed file from git not my local file system! – Reema Oct 20 '21 at 14:35