Skip to contentSkip to conversation

last commit in a directory

DISCUSSION Leonid Podolny 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi,
I have a really simple question: how do I find a last commit for the given directory inside the repository? I want to avoid rebuilding the specific part of the project if there were no changes in it since the last build, so I need to find the sha of the last time the directory was changed.
Thanks, L.

#1 lore raw

Am 1/25/2011 9:29, schrieb Leonid Podolny:

Quoted 2 lines

I have a really simple question: how do I find a last commit for the given directory inside the repository?

git log -1 that/directory

But if you need it in a script, this is preferable:

  lastsha1=$(git rev-list -1 HEAD -- "$directory")

-- Hannes

#2 lore raw
Quoted 10 lines · Johannes Sixt

Am 1/25/2011 9:29, schrieb Leonid Podolny:

Quoted 2 lines

I have a really simple question: how do I find a last commit for the given directory inside the repository?

git log -1 that/directory

But if you need it in a script, this is preferable:

   lastsha1=$(git rev-list -1 HEAD -- "$directory")

Thanks!