From 3f54e550926f5f10bcd3524f8e2b721e1aa83859 Mon Sep 17 00:00:00 2001 From: byt3h3ad Date: Thu, 28 Dec 2023 18:24:36 +0530 Subject: [PATCH] new file: file-difference-in-git-style.md --- git/file-difference-in-git-style.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 git/file-difference-in-git-style.md diff --git a/git/file-difference-in-git-style.md b/git/file-difference-in-git-style.md new file mode 100644 index 0000000..bc32d08 --- /dev/null +++ b/git/file-difference-in-git-style.md @@ -0,0 +1,12 @@ +# Show file difference in `git` style + +```bash +git diff --no-index +``` + +Normally, `git diff` compares the working tree or staging area to a specific commit or another commit. With `--no-index`, you can compare any two paths on your filesystem, regardless of their inclusion in the Git repository. Useful for comparing changes before staging them or for comparing working copies of files outside the repository. Offers similar functionality to the diff command but integrates with Git features like highlighting staged changes. + +You can also use wildcards, like `git diff --no-index src/*.js my_changes/*.js` to compare all files with the `.js` extension in both directories. + +[source](https://git-scm.com/docs/git-diff#Documentation/git-diff.txt-emgitdiffemltoptionsgt--no-index--ltpathgtltpathgt) +