Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to git diff without typing the whole path

Tags:

git

github

I'm using the github windows shell and I'll do the following

git status 

see a list of modified files and want to remind myself what's changed. I'll have to type something like

git diff Source\FooBar\Pages\FooBar.aspx 

That seems like a lot of characters to have to type. Is there some easier workflow to look at diffs that I'm not seeing?

like image 641
user76379 Avatar asked Dec 31 '12 23:12

user76379


People also ask

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.

Can you git diff two files?

The git diff command is used to perform the diff function on Git data sources. For example, commits, branches, files, and so on. It can also be used to compare two files of different branches.

How do I continue git diff?

While in git diff , simply hit n to go straight to the next file, and again to the one afterwards, and so on. You can also use N to go back a file. (For these commands to work, you'll need to first type /^diff and press Enter , as explained in this answer.) Pressing n finds the next search term.

How does git diff command work?

Comparing changes with git diffDiffing is a function that takes two input data sets and outputs the changes between them. git diff is a multi-use Git command that when executed runs a diff function on Git data sources. These data sources can be commits, branches, files and more.


1 Answers

git diff -- **/FooBar.aspx 

In general * stands for any part of a filename while ** stands for any subpath. E.g. git diff -- **/main/**/*.aspx will diff only aspx files that are residing somewhere in a subdirectory of main or main itself. This applies to other commands that accept paths, like commit and add.

like image 147
jartur Avatar answered Sep 18 '22 14:09

jartur