-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new file: file-difference-in-git-style.md
- Loading branch information
Showing
1 changed file
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Show file difference in `git` style | ||
|
||
```bash | ||
git diff --no-index <path1> <path2> | ||
``` | ||
|
||
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) | ||
|