Useful Git Snippets
May 7, 2023
note-to-self
Bring back a deleted file, after it's been committed and pushed: git checkout <deletion commit hash>~1 -- <filename>
Pull without going thru all the SSL self-signed BS but also not permanently overriding it. I used this a few times on a client network with a self-signed cert in the chain but no time to update the chain: git -c http.sslVerify=false pull
Another way: GIT_SSL_NO_VERIFY=true git push --tags
(--tags
is optional, I needed it for that)
Get the most recent log entry: git log -1
Remove local branches no longer on the remote: git fetch --prune
or git remote prune origin
(check; this doesn't seem to always work)
Compare: https://github.com/ha17/foobar/compare/<sha or branch or tag>...<sha or branch or tag>
```