My goal is to check the commits to be pushed in pre-push hook to see if they contain sensitive data or not. I have an assumption that those commits which already exist in remote repos have no need to check. So I read the Git doc and pre-push.sample file, I know that if we push to a new branch that the remote does not have, $remote_oid weil be zero, so we need to examine all commits in this branch. We can run `git rev-list $local_oid` to get all commits to be examined. But consider this case, if I'm developing a huge project which has millions of commits. I create a new branch (we call it feat/awesome-feat) based on the master branch on my local repo, and create three commits. Then I run the `git push --set-upstream origin feat/awesome-feat` command to push the three commits to the remote. But when the pre-push hook is called, `git rev-list $local_oid` will print millions of commits. The commits except the new three already exist in the remote repo. And the `git push` command will send data only in the new commits to the remote, instead of all history commits. So I mean we've no idea which commits will be sent to the remote indeed in the pre-push hook when pushing to a new branch that the remote doesn't have. I found a workaround: * Run `git ls-remote -q -h` command to get the commits the remote has. * Run `git rev-list $local_oid ^$haves` command to get the commits to be pushed.($haves are the commits obtained from the previous step). But this workaround seems to be stupid when the remote has many branches. I wonder if there is any better way to get the commits to be pushed accurately in the pre-push hook.