1
0
Fork 0
mirror of https://github.com/actions/checkout.git synced 2025-03-28 19:10:06 +01:00

README.md: Document how to do git diff vs. master

 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?
This commit is contained in:
Christian Clauss 2020-03-01 15:01:08 +01:00 committed by GitHub
parent 096e927750
commit bc7e2aae6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)