Make git ignore modification date changes if the content of the file stays the same

后端 未结 2 1339
栀梦
栀梦 2021-02-05 07:58

I have python scripts which generate and modify different xml-files. They work so that they open a file, create an ElementTree object based on it, try to modify object\'s conten

相关标签:
2条回答
  • 2021-02-05 08:27

    Git doesn't report changes in modification time.

    $ git init
    Initialized empty Git repository in /home/choroba/...
    $ echo > a
    $ git add a
    $ git commit -m init
    [master (root-commit) d686390] init
     1 file changed, 1 insertion(+)
     create mode 100644 a
    $ touch -m a
    $ git status
    On branch master
    nothing to commit, working directory clean
    
    0 讨论(0)
  • 2021-02-05 08:45

    You can do git add for all affected files, after that it stops displaying them as modified in git status (and doesn't actually stage them for commit if there are no changes). At least that worked for me (I'm using git 2.8.1).

    0 讨论(0)
提交回复
热议问题