FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Removing a Commit From a GitHub Repository · codonlibrary/codonPython Wiki · GitHub

Removing a Commit From a GitHub Repository

NatashaChetwynd edited this page Nov 26, 2019 · 1 revision

Remove a Commit

Editing the git history is bad practice in version control and should only be done in the case of a security issue.

Furthermore, please make sure that the author of the commit removes the file from their version of the branch, otherwise the same issue will occur.


1.Type the following command into GitBash/Command prompt (optional: you can include the hash value of the commit if you want to reset a specific commit).

git resetsoft HEAD^

This will reset the repository to a previous state.

2.Use the following git command to show that the repository has been returned to a previous state.

git commit -mReverting to the state of the project at <commit/commit hash>

Edit <commit/commit hash> to state the specific commit/commit hash you are reverting to

3.Type the following git command into GitBash/Command prompt.

git push origin <name_of_branch> --force

4.Check the GitHub page here, finding the relevant repository/branch, to ensure the commit was removed from the commit history.

5.Ensure the author of the commit also follows this step-by-step guide to remove/modify the commit in their clone of the repository.

Wiki pages Pages 10

Clone this wiki locally


Back | FazBrowse Home | New Git URL