Only run pre-commit on the changes (#7106)
Run pre-commit on all files may change files that are not part of the
current branch.
The updated script will only run pre-commit on the files that have been
changed in the current branch.
Signed-off-by: Hongwei <hongweichen@microsoft.com>