Gulzar
Gulzar

Reputation: 27946

How to find all commits by user to *any* repo in bitbucket?

I have many repos, in which I need to find some commit I made a very long time ago. Due to reasons, I don't know which repos I have commits in, and when I did those commits.

I could go over them one by one, looking for when I did commits.

Is there some API or UI to just see all commits by a user, to any repo, sorted by time?

Upvotes: 6

Views: 5310

Answers (1)

Cole Tierney
Cole Tierney

Reputation: 10314

You could use git's -C option with each of your repo paths to run git commands in them. Depending how your repos are locally organized, you may want to change how the paths are discovered. Change username to your committer email address. The pattern just needs to be unique, so you can probably leave off @example.com. Change the --before option as needed.

#!/usr/bin/env bash

for d in ~/path-to-repos/*/.git; do
    r=${d%.git}
    echo "$r"
    git -C "$r" log \
        --committer=username \
        --before=2013 \
        --reverse \
        --pretty='format:%h  %cd  %s'
done

You might want to experiment with git log's --pretty options.

Upvotes: 6

Related Questions