Beware of this git(1) gotcha:
Senza categoria
1
Post
1
Autori
0
Visualizzazioni
-
Beware of this git(1) gotcha:
If you do
$ git log --oneline file.txt
you'll get your list of commits on file.txt. If you
$ git log --oneline -1 file.txt
you'll get just the first (most recent) one.
If you reverse your initial output
$ git log --oneline --reverse file.txt
you get things in the opposite order. But if you want the first one of those (the oldest modification of the file), you can't use -1 like
$ git log --oneline --reverse -1 file.txt
because as the man-page says, "Note that these [filtering criteria like `-1`] are applied **before** commit ordering and formatting options, such as --reverse" [emphasis mine]
So instead you need to use
$ git log --oneline --reverse file.txt | head -1
-
undefined Stefano Marinelli ha condiviso questa discussione