Git Repo Delete Particular Commits

  1. git rebase: git rebase -i <old-commit>

    • Change pick into drop
    • Delete the commit line
  2. git filter-branch

# Delete the greped commit
git filter-branch --commit-filter '
    if echo "$GIT_COMMIT" | grep -q -e "message1" -e "message2"
    then
        skip_commit "$@"
    else
        git commit-tree "$@"
    fi
' HEAD
# Push to the remote
git rebase --continue
git push origin --force --all -v