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