Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 615281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:12:12+00:00 2026-05-13T18:12:12+00:00

In the GitFaq I can read, that Git sets the current time as the

  • 0

In the GitFaq I can read, that

Git sets the current time as the timestamp on every file it modifies, but only those.

However, I tried this command sequence:

$ git init test && cd test
Initialized empty Git repository in d:/test/.git/

$ touch filea fileb

$ git add .

$ git commit -m "first commit"
[master (root-commit) fcaf171] first commit
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 filea
 create mode 100644 fileb

$ ls -l > filea

$ touch fileb -t 200912301000

$ ls -l
total 1
-rw-r--r--    1 exxxxxxx Administ      132 Feb 12 18:36 filea
-rw-r--r--    1 exxxxxxx Administ        0 Dec 30 10:00 fileb

$ git status -a
warning: LF will be replaced by CRLF in filea
# On branch master
warning: LF will be replaced by CRLF in filea
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#






#       modified:   filea
#

$ git checkout .

$ ls -l
total 0
-rw-r--r--    1 exxxxxxx Administ        0 Feb 12 18:36 filea
-rw-r--r--    1 exxxxxxx Administ        0 Feb 12 18:36 fileb

Why did Git change the timestamp of file fileb? I’d expect the timestamp to be unchanged.

Are my commands causing a problem?
Maybe it is possible to do something like a git checkout . --modified instead?

I am using git version 1.6.5.1.1367.gcd48 under MinGW and Windows XP.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:12:12+00:00Added an answer on May 13, 2026 at 6:12 pm

    This doesn’t occur on a Linux filesystem. I tested the exact scenario you described and my modification times are preserved for the files I have left untouched:

    sean@SEAN-PC:~/Desktop/test$ ls -la tests/BusTests.*
    -r--r--r-- 1 sean sean 8 2010-02-11 11:53 tests/BusTests.c
    -r--r--r-- 1 sean sean 1 2010-02-11 11:51 tests/BusTests.h
    
    sean@SEAN-PC:~/Desktop/test$ git status -a
    # On branch master
    # Changes to be committed:
    #   (use "git reset HEAD <file>..." to unstage)
    #
    #       modified:   tests/BusTests.c
    #
    
    sean@SEAN-PC:~/Desktop/test$ git checkout .
    
    sean@SEAN-PC:~/Desktop/test$ ls -la tests/BusTests.*
    -r--r--r-- 1 sean sean 1 2010-02-11 11:55 tests/BusTests.c
    -r--r--r-- 1 sean sean 1 2010-02-11 11:51 tests/BusTests.h
    

    I suspect that this is an unknown bug in the MinGW build of Git. You might want to report it to the developers: http://code.google.com/p/msysgit/issues/list

    It would be interesting to see if the BusTests.h modification stamp is modified when you only checkout the modified file:

    git checkout -- tests/BusTests.c
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 351k
  • Answers 351k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Not on the InputStream generally, but you can use Socket#setSoTimeout(int)… May 14, 2026 at 7:20 am
  • Editorial Team
    Editorial Team added an answer $_SERVER['REMOTE_ADDR']; According to the PHP documentation: The IP address from… May 14, 2026 at 7:20 am
  • Editorial Team
    Editorial Team added an answer setup.exe is definitely the most popular convention in the Windows… May 14, 2026 at 7:20 am

Related Questions

I want to have a bare git repository stored on a (windows) network share.
I have to rewrite the history of my repository because it contains some credentials.
I have this piece of code: $(#faq).click(function () { var url = $.get(faq, {
In the How Can I Expose Only a Fragment of IList<> question one of
In the course of your software development lifecycle, what essential design artifacts do you

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.