I want to somehow want to see if there is a way to get the time for when a file was committed
on Github. I have tried using PyGithub
and GitPython
, but they don't have any options as such. Does anyone know a way around this?
Asked
Active
Viewed 253 times
0

Harshdeep Singh
- 327
- 1
- 5
- 18
-
"committed on github" makes no sense. Do you mean pushed to github? Or committed locally? – guido Oct 10 '16 at 17:16
-
pushed to github. Sorry about that. – Harshdeep Singh Oct 10 '16 at 20:18
1 Answers
1
you can check the hour in the log
so do git log
to check all commits hours.
but if you want an specific file, you should use the flag --follow
so try this:
git log --follow filename
another aproach
if you want just to check the date of an specific commit use this command
git show -s --format=%ci <commit>
Pythonic way
import git
g = git.Git("/path/to/your/repo")
loginfo = g.log()
print loginfo
or
import git
g = git.Git("/path/to/your/repo")
loginfo = g.log('--format=%ci <commit>')
print loginfo

Lucas Batista Gabriel
- 890
- 7
- 13
-
-
-
Done, sure. is there any way to get the `file` associated with each commit as well? – Harshdeep Singh Oct 10 '16 at 21:11
-
to get file use: `g.log('--', "YOUR_FILE_NAME.FILE_EXTENSION")` – Lucas Batista Gabriel Oct 10 '16 at 21:19