threads / discuss / 26332

last commit in a directory

Subject: last commit in a directory

## tl;dr

3 messages between Jan 25, 2011 and Jan 25, 2011.

replies: 2people: 2as markdown or json

Leonid Podolny· Jan 25, 2011, 08:29 UTC · lore
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.
Johannes Sixt· Jan 25, 2011, 08:47 UTC · re: Leonid Podolny · lore

Re: last commit in a directory

Am 1/25/2011 9:29, schrieb Leonid Podolny:
> 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
Leonid Podolny· Jan 25, 2011, 08:50 UTC · re: Johannes Sixt · lore

Re: last commit in a directory

On 01/25/2011 10:47 AM, Johannes Sixt wrote:
Show 10 quoted lines
> Am 1/25/2011 9:29, schrieb Leonid Podolny:
>> 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!

← back to recent threads