on master help sign in
Add "git show" section
commitfbee9df71959587656d3deb4d9dce512a49ee7ef authorDavid Peter <sharkdp@users.noreply.github.com> dateMon 11 Feb 2019, 22:04 (8 years ago) parent6e9ca7d
1 file changed+9−1
README.md+9−1
README.md+9−1
@@ -114,12 +114,20 @@ tail -f /var/log/pacman.log | bat --paging=never -l log
114114Note that we have to switch off paging in order for this to work. We have also specified the syntax
115115explicitly (`-l log`), as it can not be auto-detected in this case.
116116
117+### `git show`
118+
119+You can combine `bat` with `git show` to view an older version of a given file with proper syntax
120+highlighting:
121+```bash
122+git show v0.6.0:src/main.rs | bat -l rs
123+```
124+
117125#### `xclip`
118126
119127The line numbers and Git modification markers in the output of `bat` can make it hard to copy
120128the contents of a file. To prevent this, you can call `bat` with the `-p`/`--plain` option or
121129simply pipe the output into `xclip`:
122−```
130+```bash
123131bat main.cpp | xclip
124132```
125133`bat` will detect that the output is being redirected and print the plain file contents.