1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-18 06:28:02 +00:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Nicholas Wilson
87b992b887 Merge 5615da920f into 8801f39df0 2024-12-19 19:26:17 -05:00
jbranchaud
8801f39df0 Add Manually Pass Two Git Files To Delta as a Unix TIL 2024-12-19 18:24:27 -06:00
Bob Conan
5615da920f Update README.md, fix typos 2024-11-15 16:16:31 -06:00
BobConanDev
c60c63f554 Updated README.md, fix typo(s) 2024-11-15 16:42:57 -05:00
2 changed files with 36 additions and 3 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1542 TILs and counting..._
_1543 TILs and counting..._
---
@@ -191,7 +191,7 @@ _1542 TILs and counting..._
- [Aliasing An Ansible Host](devops/aliasing-an-ansible-host.md)
- [Allow Cross-Origin Requests To Include Cookies](devops/allow-cross-origin-requests-to-include-cookies.md)
- [Allow HTTPS Through Your UFW Firewall](devops/allow-https-through-your-ufw-firewall.md)
- [Check For Cached Site Assocation File For iOS](devops/check-for-cached-site-association-file-for-ios.md)
- [Check For Cached Site Association File For iOS](devops/check-for-cached-site-association-file-for-ios.md)
- [Check The Status of All Services](devops/check-the-status-of-all-services.md)
- [Check The Syntax Of nginx Files](devops/check-the-syntax-of-nginx-files.md)
- [Connect To An RDS PostgreSQL Database](devops/connect-to-an-rds-postgresql-database.md)
@@ -745,7 +745,7 @@ _1542 TILs and counting..._
- [Check If Clusters Are Upgrade Compatible](postgres/check-if-clusters-are-upgrade-compatible.md)
- [Check If The Local Server Is Running](postgres/check-if-the-local-server-is-running.md)
- [Check If User Role Exists For Database](postgres/check-if-user-role-exists-for-database.md)
- [Check Table For Any Oprhaned Records](postgres/check-table-for-any-orphaned-records.md)
- [Check Table For Any Orphaned Records](postgres/check-table-for-any-orphaned-records.md)
- [Checking Inequality](postgres/checking-inequality.md)
- [Checking The Type Of A Value](postgres/checking-the-type-of-a-value.md)
- [Clear The Screen In psql](postgres/clear-the-screen-in-psql.md)
@@ -1528,6 +1528,7 @@ _1542 TILs and counting..._
- [Load Env Vars In Bash Script](unix/load-env-vars-in-bash-script.md)
- [Look Through All Files That Have Been Git Stashed](unix/look-through-all-files-that-have-been-git-stashed.md)
- [Make Direnv Less Noisy](unix/make-direnv-less-noisy.md)
- [Manually Pass Two Git Files To Delta](unix/manually-pass-two-git-files-to-delta.md)
- [Map A Domain To localhost](unix/map-a-domain-to-localhost.md)
- [Negative Look-Ahead Search With ripgrep](unix/negative-look-ahead-search-with-ripgrep.md)
- [Occupy A Local Port With Netcat](unix/occupy-a-local-port-with-netcat.md)

View File

@@ -0,0 +1,32 @@
# Manually Pass Two Git Files To Delta
I recently [wired up `delta` as my default pager and differ for
`git`](git/better-diffs-with-delta.md). However, when I installed `delta`, I
first wanted to see what its diff output looked like.
How can I pass two versions of the same file from `git` to `delta`?
I can show the current contents of a file with `git show` referencing the
`HEAD` commit.
```bash
$ git show HEAD:main.go
```
Similiarly, I can show the contents of that file _one_ commit ago with `HEAD~`.
```bash
$ git show HEAD~:main.go
```
I can then pass each of those commands as virtual files to `delta` using the
`<()` syntax. The older file goes first and the newer second.
```bash
$ delta <(git show HEAD~:main.go) <(git show HEAD:main.go)
```
That works and comes in handy if you need to compare two things that aren't
necessarily files or aren't necessarily under version control. However, in
hindsight, I'd say it is easier to add delta as the pager and differ and try it
out directly.