From bc7e2aae6abaff77752e1a8b909c998d42339463 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 1 Mar 2020 15:01:08 +0100 Subject: [PATCH] README.md: Document how to do git diff vs. master #161 and many other posts say that doing `git diff` was easy in v1 but is tricky in v2. Can we please add two items to README.md that describes how to properly do `git diff` in v2? --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 54b3429..120d351 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,24 @@ jobs: git fetch --prune --unshallow ``` +## Lines of code added or modified vs. master +```yaml +# FAILS!!! +- run: git diff --diff-filter=am master HEAD > git_diff.txt || true + # fatal: ambiguous argument 'master': unknown revision or path not in the working tree. +- run: git diff --diff-filter=am origin/master HEAD > git_diff.txt || true + # fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree. +``` + +## File paths of files added or modified vs. master +```yaml +# FAILS!!! +- run: git diff --diff-filter=am --name-only master HEAD > git_diff.txt || true + # fatal: ambiguous argument 'master': unknown revision or path not in the working tree. +- run: git diff --diff-filter=am --name-only origin/master HEAD > git_diff.txt || true + # fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree. +``` + # License The scripts and documentation in this project are released under the [MIT License](LICENSE)