My local git repository is inside encrypted volume. I would like to be able to run git pull --all
only when the remote has new commits. However, I'm unable to use post-receive hook like here since I don't have the password to the encrypted volume. This means that even if the hook will be triggered I still don't know the password to mount the volume and to pull the new changes. So I'm looking for some other alternatives, one possible way I was thinking of was to ask the remote for the latest version SHA and compare it with the latest version SHA that the local copy knows, if they match I don't need to run pull command and if they don't match then I need to run the git pull command.
Is there a way I can run git rev-parse master
on the remote repository?
You can get more background about my problem here
You can't do that literally.
There are two easy approximations:
git rev-parse
and even git rev-list
over there, which gets you as many SHA-1s as you want.git ls-remote
to get the head SHA-1s from the remote (including refs/heads/master
). All that will tell you is "same" or "different", assuming you have the head SHA-1s locally. If they are different, you can't tell precisely why (though you can get probably-enough if you walk the local revs).There's something weird about the question, though: you say the local repo is in an encrypted volume to which you do not have the password. If that's so, how do you know what the local heads are, and/or their history? They're recorded inside the repo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With