I have a project which sources are controlled with help of git.
Right now I want to find out when my teammate made last edits in a specific file. I want to find out SHA1 of commit or to see his edits as diff.开发者_如何学C
I guess I can use git log --stat <path/to/file>
and review list of all commits where my file was changed.
Are there any quick ways to do it?
you can use git log with a pathspec and --author
option:
git log --author=your_teammate -- path/to/file
Yes! you can use git blame
git blame <file>
every line of that file will be shown who is the one edited the last.
I would use this line
git log --format="%H--%ad-%an" fileName
If you only want the last change, use this
git log --format="%H--%ad-%an" -n 1 fileName
If you are looking for a single specific author, pipe it through grep
git log --format="%H--%ad-%an" fileName | grep "Author Name"
精彩评论