Git doesn't show changes even though file has changed


Alex

Is git broken or are we doing something wrong? ;-)

We found out that a file has changed in the latest version of the git repository and I am trying to figure out when it was used whatchanged.

how so:

$ git checkout 27773b72432e86d308d25d666663f237e50aa3fd Tools/foo.php
$ md5sum Tools/foo.php
85552061cae9832c11eb6607ac88e3d8 Tools/foo.php
$ git checkout master Tools/foo.php
$ md5sum Tools/foo.php
f38f51232785a432af2d1bd8db4429ed  Tools/foo.php

but:

$ git whatchanged 27773b72432e86d308d25d666663f237e50aa3fd..master  | grep foo.php
# empty result

How could this be?

Mark Adlesberg

The short answer is that you might want to try using

git whatchanged master..27773b72432e86d308d25d666663f237e50aa3fd

(Indeed, you really should be using it git loginstead, but that's irrelevant why it's not doing what you expect.)

Here is some information to help understand why:

As other users have suggested , this notation 27773b72432e86d308d25d666663f237e50aa3fd..masterdoesn't mean "a series of commits that starts with (but does not include) and ends with (and includes) ". It can sometimes be reduced to that, but that's not what it's meant to be . (Later, you'll see the importance of the distinction.)27773b7master

This means "all commits reachable from masterbut not reachable from 27773b7". ("Reachable" means via the parent pointer.)

Now, if we assume your commit graph looks like

 .... 27773b7 -- A -- B -- C <--(master)

Then this would be reduced to the type of "scope" that others have already identified. But in that case you won't have a problem. This is because the file you've shown is different from 27773b7the file at C( master) , which means that Aeither Bor Cmust have been changed. If your commit graph looks like that.

So we can conclude that your commit graph does n't look like this.

Another way it looks is

--- o -- A -- 27773b7 -- x ...
     \
      B -- C <--(master)

In this diagram, the 27773b7...mastermeans are only Band C, since Ais unreachable master, although it o is reached by master, it is also reached 27773b7.

Now, the reason the file is different could be that the file 27773b7was changed Aor was changed 27773b7. In either case, using 27773b7^(as shown in other answers) won't help.

This brings me back to my point: if you really want to A..Bdefine a symbol as a range, you can't assume that the range starts as A; if there is one, you want it to be the merge base between and A( Bif there is; Sometimes it might just be the root of the Bs commit hierarchy ) - equal to Aonly Areachable from from B. And you can't assume its linear commit range anyway.

But knowing the subset of commit graphs it really indicates can make it a bit clearer, i.e. if A..Bnothing shows up, you might want to try B..A.

Related


Git doesn't show changes even though file has changed

Alex Is git broken or are we doing something wrong? ;-) We found out that a file has changed in the latest version of the git repository and I am trying to figure out when it was used whatchanged. how so: $ git checkout 27773b72432e86d308d25d666663f237e50aa3fd

Git doesn't show changes even though file has changed

Alex Is git broken or are we doing something wrong? ;-) We found out that a file has changed in the latest version of the git repository and I am trying to figure out when it was used whatchanged. how so: $ git checkout 27773b72432e86d308d25d666663f237e50aa3fd

Git doesn't show changes even though file has changed

Alex Is git broken or are we doing something wrong? ;-) We found out that a file has changed in the latest version of the git repository and I am trying to figure out when it was used whatchanged. how so: $ git checkout 27773b72432e86d308d25d666663f237e50aa3fd

Git doesn't show changes even though file has changed

Alex Is git broken or are we doing something wrong? ;-) We found out that a file has changed in the latest version of the git repository and I am trying to figure out when it was used whatchanged. how so: $ git checkout 27773b72432e86d308d25d666663f237e50aa3fd

Git doesn't show changes even though file has changed

Alex Is git broken or are we doing something wrong? ;-) We found out that a file has changed in the latest version of the git repository and I am trying to figure out when it was used whatchanged. how so: $ git checkout 27773b72432e86d308d25d666663f237e50aa3fd

Git force push a file that git doesn't know has changed?

Michau Skripek I'm fiddling with PageSpeed Insights, which is causing me to compress my css and js files in Webpack to .br (with Brotli) and .gz (with gzip) so they can be served to browsers that accept them. .htaccess to decide. AddTypeI had to use close beca

Webview doesn't show even though there is no error

Tech Atmosphere: My app has a webview. Not only limited to web views and websites with constraint layouts, but also the ability to set permissions to Internet. Why am I still getting blank pages on my app? my code: manifest <?xml version="1.0" encoding="utf-8"

Webview doesn't show even though there is no error

Tech Atmosphere: My app has a webview. Not only limited to web views and websites with constraint layouts, but also the ability to set permissions to Internet. Why am I still getting blank pages on my app? my code: manifest <?xml version="1.0" encoding="utf-8"

Git status shows file changed even though content is the same

Aron rotteveel I get a git checkout from someone else and am trying to commit the unmade changes to the local repository. However, many , if not every, file will be modified even if the content is exactly the same . I have set core.fileModeto false and also se

Git status shows file changed even though content is the same

Aron rotteveel I get a git checkout from someone else and am trying to commit the unmade changes to the local repository. However, many , if not every, file will be modified even if the content is exactly the same . I have set core.fileModeto false and also se

Git status shows file changed even though content is the same

Aron rotteveel I get a git checkout from someone else and am trying to commit the unmade changes to the local repository. However, many , if not every, file will be modified even if the content is exactly the same . I have set core.fileModeto false and also se