Sublime Forum

Git log from a folder

#1

I want to get the logs of a specific folder in the repo.
How do I do that in Sublime Merge?

For example, with this tree:

root
├── services
│   ├── pom.xml
│   └── protobuf
└── workers
    ├── asyncprocess
    │   ├── pom.xml
    ├── demux
    │   └── pom.xml
    └── pom.xml

Something close to the equivalent of doing:

git log -p workers

So basically I want to narrow the commits by directory.
And git does it recursively.
Regards.

0 Likes

#2

You can use the search functionality to achieve this. eg: a search for path:src/ will give you all the commits affecting files in src/.

0 Likes

#3

That does not seem to work to me…

0 Likes

#4

Maybe try with a glob? eg: path:src/*

0 Likes

#5

I already tried that and it does not work…
And it doesn’t work because path:pattern looks for a pattern of the file, not what I am asking for.

0 Likes

#6

Using the glob patterns produces the same output for me as git log -p {dir}, so I’m not sure what you’re asking for. git log {dir} gives you all the commits affecting files inside {dir}, the same is true for path:{dir}/* searches in Sublime Merge. -p gives you the patches, which Sublime Merge always does on the right hand column.

0 Likes

#7

It doesn’t work as git log -p <folder>.
Because git does it recursively, and that path:pattern does not.

Does anyone know how to do it recursively?

0 Likes

#8

Does path:{dir}/** help you out?

2 Likes

#9

Yes! That did it!
Do you know where is that documented?
Thank you very much @deathaxe !

0 Likes

#10

** is a “glob” pattern. git makes use of it in .gitignore or .gitattributes files. I am glad SM supports them and would whish ST would do as well.

see: https://git-scm.com/docs/gitignore

0 Likes

#11

Oh well, I know .gitignore patterns.
But didn’t know I could use them in SM search text-box.
I was referring to SM manual/help.
May the authors can add a note in the Query Syntax help.
Anyway, that made it and I am happy.
:grin:

0 Likes