0

This is my first time using github and I was having trouble with some of the commands and committed the same thing about 7 times through terminal. I don't know how this is possible because I thought you could only commit if there are changes made in the file. I wasn't seeing anything every time I committed so I kept deleting and remaking the same repository with the same name and tried committing over and over until I finally saw them now but theres too many I just want to see 1 initial commit not all 7. I want to know if there is a way to delete a commit if I have my github account open in my browser not by using terminal.

Note on possible duplicate: Please do not mark question as duplicate. I know there are similar questions/exact same questions asked. However I have read those and most of them are commands you have to type in the terminal and because there is no way to undo that I would prefer to do this through the website. I don't want to accidentally delete something I want and not be able to get my work back later. If there is something else I can use rather then terminal I would prefer to use that instead.

1 Answers1

0

If you push your commits then I'm afraid there's no way to delete them. But if you haven't pushed your commits to the remote repository, then you can change the HEAD to the previous commit.

If you had pushed your commits in a branch, and then delete the branch without merging it with any other branches (you can not delete the default and protected branches), then technically the commits will also be deleted.

omar jayed
  • 699
  • 4
  • 13
  • I used git push when I committed through terminal. I guess I will just have to make a new project if I want those commits gone now. Thanks for the info. @omarjayed –  Mar 31 '20 at 03:08