I was attempting to completely delete a commit I just made and I'm trying to figure out how to do it inside of git tower. I had clicked on the Make a collection commit and did revert but not sure if that was right. So what I want to do is have the commit with the subject Include recipes from course teacher as the most recent commit and delete the two above it. Thoughts on how I can do this?
Asked
Active
Viewed 953 times
1 Answers
1
If the commit you want to delete is the last one, you have to do a git reset --hard
pointing the previous commit.
The revert create another commit to delete changes, not really deleting the commit.
WARNING, you will loose all files of your working tree. If you have some, stash them.
If you already push the commit you want to delete, I advise you to keep the revert, otherwise you will have to push force. See there : Git delete commit
-
So I clicked on the include recipes from course teacher and clicked reset and it now has that commit as HEAD and master however there is a commit above it that says origin/master. What should I do to fix this? – user3732216 May 29 '16 at 16:22
-
Are you alone to work/push on this remote ? If it's the case, you can push with force option. It will erase history on the remote to replace by your own master branch. This is the reason why it is not recommended to do that if you are not alone to push/pull this repo – Flows May 29 '16 at 16:27
-
Thank you. I was able to get things back to where they should be. – user3732216 May 29 '16 at 16:29
-
It's your own project, so there is no issue to push force. You're welcome – Flows May 29 '16 at 16:30