1GIT-RESTORE-MTIME(1) General Commands Manual GIT-RESTORE-MTIME(1)
2
3
4
6 git-restore-mtime - Restore original modification time of files based
7 on the date of the most recent commit that modified them
8
10 git-restore-mtime [-h] [--quiet|--verbose]
11 [-C DIRECTORY] [--work-tree WORKDIR] [--git-dir
12 GITDIR]
13 [--force] [--merge] [--first-parent] [--skip-missing]
14 [--no-directories] [--test] [--commit-time]
15 [--oldest-time]
16 [--skip-older-than SECONDS] [--unique-times]
17 [--version]
18 [PATHSPEC [PATHSPEC...]]
19
21 Change the modification time (mtime) of files in the work tree based on
22 the date of the most recent commit that modified the file, as an
23 attempt to restore the original modification time. Useful when
24 generating release tarballs.
25
26 Ignore untracked files and uncommitted deletions, additions and
27 renames, and by default modifications too.
28
30 Positional arguments:
31 PATHSPEC
32 Only modify paths matching PATHSPEC, relative to current
33 directory. By default, update all but untracked files and
34 submodules.
35
36 Optional arguments:
37 -h, --help
38 show help message and exit
39
40 --quiet,-q
41 Suppress informative messages and summary statistics.
42
43 --verbose,-v
44 Print additional information for each processed file. Specify
45 twice to further increase verbosity.
46
47 -C DIRECTORY, --cwd DIRECTORY
48 Run as if restore-mtime was started in directory DIRECTORY.
49 This affects how --work-tree, --git-dir and PATHSPEC arguments
50 are handled. See git(1) for more information.
51
52 --git-dir GITDIR
53 Path to the git repository, by default auto-discovered by
54 searching the current directory and its parents for a .git/
55 subdirectory.
56
57 --work-tree WORKDIR
58 Path to the work tree root, by default the parent of GITDIR if
59 it's automatically discovered, or the current directory if
60 GITDIR is set.
61
62 --force, -f
63 Force updating files with uncommitted modifications. Untracked
64 files and uncommitted deletions, renames and additions are
65 always ignored.
66
67 --merge, -m
68 Include merge commits. Leads to more recent times and more
69 files per commit, thus with the same time, which may or may not
70 be what you want. Including merge commits may lead to fewer
71 commits being evaluated as files are found sooner, which can
72 improve performance, sometimes substantially. But as merge
73 commits are usually huge, processing them may also take longer.
74 By default, merge commits are only used for files missing from
75 regular commits.
76
77 --first-parent
78 Consider only the first parent, the "main branch", when
79 evaluating merge commits. Only effective when merge commits
80 are processed, either when --merge is used or when finding
81 missing files after the first regular log search. See --skip-
82 missing.
83
84 --skip-missing, -s
85 Do not try to find missing files. If merge commits were not
86 evaluated with --merge and some files were not found in regular
87 commits, by default restore-mtime searches for these files
88 again in the merge commits. This option disables this retry,
89 so files found only in merge commits will not have their
90 timestamp updated.
91
92 --no-directories, -D
93 Do not update directory timestamps. By default, use the time
94 of its most recently created, renamed or deleted file. Note
95 that just modifying a file will NOT update its directory time.
96
97 --test, -t
98 Test run: do not actually update any file timestamp.
99
100 --commit-time, -c
101 Use commit time instead of author time.
102
103 --oldest-time, -o
104 Update times based on the oldest, instead of the most recent
105 commit of a file. This reverses the order in which the git log
106 is processed to emulate a file "creation" date. Note this will
107 be inaccurate for files deleted and re-created at later dates.
108
109 --skip-older-than SECONDS
110 Ignore files that are currently older than SECONDS. Useful in
111 workflows that assume such files already have a correct
112 timestamp, as it may improve performance by processing fewer
113 files.
114
115 --skip-older-than-commit, -N
116 Ignore files older than the timestamp it would be updated to.
117 Such files may be considered "original", likely in the author's
118 repository.
119
120 --unique-times
121 Set the microseconds to a unique value per commit. Allows
122 telling apart changes that would otherwise have identical
123 timestamps, as git's time accuracy is in seconds.
124
125 --version, -V
126 show program's version number and exit
127
129 Renames are poorly handled: it always changes the timestamps of files,
130 even if no content was modified.
131 Directory timestamps are also limited to being modified only when files
132 are added (created) or deleted in them.
133 In very large repositories, after running restore-mtime to modify the
134 timestamp of several files, further git operations may emit the error:
135 fatal: mmap failed: Cannot allocate memory.
136 This is harmless, and can be fixed by running git-status(1).
137
139 git(1), git-log(1), git-ls-files(1), git-status(1)
140 https://github.com/MestreLion/git-tools
141
143 Rodrigo Silva (MestreLion) linux@rodrigosilva.com
144
145
146
147 2022-07-27 GIT-RESTORE-MTIME(1)