cheat sheet - Using Git Diff Without a Repo

This commit is contained in:
Morgan 2020-11-26 14:52:48 +01:00 committed by GitHub
parent 7d8113a84c
commit 9b8f0d5cf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,3 +14,12 @@ git log --author="Morgan" \
--date="format:%H" |\
awk '{n=$1+0;if(H[n]++>max)max=H[n]}END{for(i=0;i<24;i++){printf"%02d -%5d ",i,H[i];for(n=0;n<H[i]/max*50;n++){printf "*"}print""}}'
```
### Using Git Diff Without a Repo ([src](https://www.jvt.me/posts/2020/10/29/git-diff-no-repo/))
The --no-index flag allows you to diff between files that aren't related to a Git repo:
#### does not work, returns status code 0
`git diff README.md ../other-repo/README.md`
#### works, returns status code 1 and the diff
`git diff --no-index README.md ../other-repo/README.md`