0

I have a file (Change_Info-hello.txt) whose date modified is 2/10/2022 . I want to push this file to remote repository expecting to see the same date in remote repository branch. I issued the following commands locally but looks like authored date is taking as current date and I am wondering when I will push to remote repo, I will see the current date instead of 2/10/2022

Any suggestion on how I can push the file where I can see 2/10/2022 in remote repo branch.

C:\Dummy\testing_git_timestamp\git_test_push_old_time>git add Change_Info-hello.txt

C:\Dummy\testing_git_timestamp\git_test_push_old_time>git commit -m "testing first push"
[master (root-commit) 6e1084d] testing first push
 1 file changed, 1 insertion(+)
 create mode 100644 Change_Info-hello.txt

C:\Dummy\testing_git_timestamp\git_test_push_old_time>git cat-file -p 6e1084d
tree e7fad102fe62c2fd382c54109e8347520b987b3e
author ryan xxxx <ryan xxxx@domain.com> 1679601209 -0400
committer ryan xxxx <ryan xxxx@domain.com> 1679601209 -0400

testing first push

C:\Dummy\testing_git_timestamp\git_test_push_old_time>git log --format=fuller
commit 6e1084db958824b89b26cfc2837d73372792a982 (HEAD -> master)
Author:     ryan xxxx <ryan xxxx@domain.com>
AuthorDate: Thu Mar 23 15:53:29 2023 -0400
Commit:     ryan xxxx <ryan xxxx@domain.com>
CommitDate: Thu Mar 23 15:53:29 2023 -0400

    testing first push

C:\Dummy\testing_git_timestamp\git_test_push_old_time>
Joe_12345
  • 589
  • 2
  • 7
  • 19
  • 1
    You can't. That kind of thing is the province of a deployment system. You can arrange to track the metadata yourself, in tracked content Git treats as any other, and supply post-checkout hooks or whatever else you want to reconstitute the filesystem status from that on demand. – jthill Mar 23 '23 at 21:08
  • https://stackoverflow.com/a/21735986/7976758 Found in https://stackoverflow.com/search?q=%5Bgit%5D+files+timestamps – phd Mar 23 '23 at 21:19
  • Also Git FAQ: https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/Git_FAQ.html#Why_isn.27t_Git_preserving_modification_time_on_files.3F – phd Mar 23 '23 at 21:19

0 Answers0