Difference between `curl -I` and `curl -X HEAD`

It seems the difference has to do with the Content-Length header and how it is treated by both commands. But before going into that, curl -X HEAD does not give any output because, by default, curl does not print headers if switch -i is not provided (not needed on -I though). In any case, curl … Read more

How do diff over ssh?

You can do it with Bash’s process substitution: diff foo <(ssh myServer ‘cat foo’) Or, if both are on remote servers: diff <(ssh myServer1 ‘cat foo’) <(ssh myServer2 ‘cat foo’)

How do I show the changes which have been staged?

It should just be: –cached means show the changes in the cache/index (i.e. staged changes) against the current HEAD. –staged is a synonym for –cached. –staged and –cached does not point to HEAD, just difference with respect to HEAD. If you cherry pick what to commit using git add –patch (or git add -p), –staged will return what is staged.

git-diff to ignore ^M

GitHub suggests that you should make sure to only use \n as a newline character in git-handled repos. There’s an option to auto-convert: Of course, this is said to convert crlf to lf, while you want to convert cr to lf. I hope this still works … And then convert your files: core.autocrlf is described on the … Read more

How can I see the changes in a Git commit?

To see the diff for a particular COMMIT hash, where COMMIT is the hash of the commit: git diff COMMIT~ COMMIT will show you the difference between that COMMIT‘s ancestor and the COMMIT. See the man pages for git diff for details about the command and gitrevisions about the ~ notation and its friends. Alternatively, … Read more