Step-1: Make sure your working directory is clean (commit or stash your current changes).
Step-2: One can use the git-rebase command to easily make changes to oneβs history.
$ git rebase -i HEAD~n # here n will for number of commits you need to view
Now git rebase command will get the following in your editor
Step-3: Change pick to drop in order to βdropβ the commit. Don't touch anything else. Delete a commit by deleting that particular line.
Step-4: Save and Exit (Ctrl + X and to save "y")
Step -5: Finally Push the changes by using the below command to update your master and the commit will be removed.
git push origin -branch-name-here --force
Top comments (0)