Skip to content

Feature Request: git log for specific directories #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ben-en opened this issue Jul 1, 2015 · 2 comments
Closed

Feature Request: git log for specific directories #308

ben-en opened this issue Jul 1, 2015 · 2 comments

Comments

@ben-en
Copy link

ben-en commented Jul 1, 2015

I'd really like to be able to do either of the following, assuming the current directory is a git repo;
git.repo().heads.master.log(DIR)
git.repo().git('log -- DIR')

Using git log --pretty=format:%H -- master results in the following output:

$ git log --pretty=format:%H -- master
526356389b024590def5df5a7e1be70b2076835a
02b3a074587a97e673de55c3e35418952a9a40c6
5c12fdf5708633eb98b88d681907748a3e0090f8
...
0d381427d1d3f65e009b27abff95d016fb134ef6

In the same directory from interactive python3 prompt using git.Repo().git.log('--pretty=format:%h -- master') does not understand -- master;

>>> import git
>>> git.Repo().git.log('--pretty=format:%h -- master')
'808810fbfc4bd58891e43fa641e0bb6137c3fc97 -- master\na8be92733c87b09c1592fdb7200633f9fee0354d -- master\n09e7a7be446393052923b2baf72537cbd1d5bf6a -- master\n79c9c62d92d13755cdc398c33249176b77047e38 -- master\n...
@Byron
Copy link
Member

Byron commented Jul 1, 2015

What if you try it this way instead: git.Repo().git.log('--pretty=format:%h', '--', 'master').

Please let me know if this solves the issue.

@ben-en
Copy link
Author

ben-en commented Jul 1, 2015

Thanks for the fast response, that did the trick! I had been trying to do it git('log --flag -- dir') which obviously does not work. I'm not sure how i managed to think that the "only takes one argument" error applied to git.log() as well.

@ben-en ben-en closed this as completed Oct 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants