-2

With command git diff toto.txt, I can see all the code changes since the last commit.

Is it possible to have all dates of code changes?

For example:

aa
bb
cc

Day 1 toto.txt becomes:

aa
bbdd
cc

Day 2:

aazz
bbdd
cc

I would like a list of changes for toto.txt with date:

  • aa -> aazz day 2
  • bb -> bbdd day 1

git blame toto.txt|grep '0000000 (Not' => 00000000 (Not Committed Yet 2023-07-25 13:15:47 +0200 20) # @svglog = Logger.new("#{RAILS_ROOT}/log/mouchard_rsf.log", 5, 610440) 00000000 (Not Committed Yet 2023-07-25 13:15:47 +0200 21) # @svglog.formatter = proc { |severity, datetime, progname, msg| is more interesting, but for Not Committed the date is the command date not the change date

jean-luc
  • 7
  • 4
  • 1
    Does this answer your question? [View the change history of a file using Git versioning](https://stackoverflow.com/questions/278192/view-the-change-history-of-a-file-using-git-versioning) – jonrsharpe Jul 25 '23 at 07:14
  • You should add more infos if you want an helpful answer (i.e. you must explain that you want date of changes not yet in a commit) – Filippo Jul 25 '23 at 11:58
  • Before create a commit, git diff toto.txt gives all changes. I would have dates of the changes. git log gives informations in relation to a commit so it is bad for me – jean-luc Jul 25 '23 at 12:21
  • 1
    Do you mean to get the date when *the file change on disk* **before** it was committed? If so, you're out of luck: git doesn't store that. The only "modification date" you can get from a change in a commit is the date of the commit itself. – Joachim Sauer Jul 26 '23 at 09:45

1 Answers1

0

It seems to me that the following command would provide the information you are looking for:

git log --patch toto.txt

This information was found in a similar question: View the change history of a file using Git versioning.

logistic-bot
  • 20
  • 1
  • 7