Skip to content

Commit c869139

Browse files
authored
Document how to ignore specific files in a diff (#1668)
1 parent 0520099 commit c869139

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: src/git.md

+12
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,18 @@ See [the docs for `--color-moved`](https://git-scm.com/docs/git-diff#Documentati
508508
See [the relevant section for PR authors](#git-range-diff). This can be useful for comparing code
509509
that was force-pushed to make sure there are no unexpected changes.
510510

511+
### Ignoring changes to specific files
512+
513+
Many large files in the repo are autogenerated. To view a diff that ignores changes to those files,
514+
you can use the following syntax (e.g. Cargo.lock):
515+
516+
```
517+
git log -p ':!Cargo.lock'
518+
```
519+
520+
Arbitrary patterns are supported (e.g. `:!compiler/*`). Patterns use the same syntax as
521+
`.gitignore`, with `:` prepended to indicate a pattern.
522+
511523
## Git submodules
512524

513525
**NOTE**: submodules are a nice thing to know about, but it *isn't* an absolute

0 commit comments

Comments
 (0)