Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable wildcard file paths for git diff?

Tags:

git

git-diff

I would expect git diff to work like git add and others, in being able to do something like

git diff **/models.py

rather than having to do

git diff /full/path/to/my/python/file/called/models.py

It's strange though because

git commit **/models.py
git add **/models.py

both work as you'd expect.

like image 672
TankorSmash Avatar asked Jun 04 '13 15:06

TankorSmash


People also ask

Why is git diff not showing?

In answer to the original question, git diff isn't showing anything because you have a brand new directory, with a newly added file, but there are zero changes in the file for git diff to show. git status is showing that you added a new file, but git diff is for showing changes within files.

Can you git diff a specific file?

The git diff command returns a list of all the changes in all the files between our last commit and our current repository. If you want to retrieve the changes made to a specific file in a repository, you can specify that file as a third parameter.

What is path to file in git?

with the path from the repository root to your current directory in the working tree. For example: cd ~/my-git-repo/dir1/dir2 git show abcd123:./Makefile # equivalent to git show abcd123:dir1/dir2/Makefile.

What is git diff tree?

git-diff-tree - Compares the content and mode of blobs found via two tree objects.


1 Answers

git diff [options] [<commit>] [--] [<path>...]

Example

git diff -- */models.py

http://kernel.org/pub/software/scm/git/docs/git-diff.html

like image 153
Zombo Avatar answered Sep 28 '22 05:09

Zombo