Without cloning the repo, only git ls-remote
would contact the remote repo to get back data (ie, the branches names and SHA1 and tags).
git ls-remote
would not bring back any other information like authorship.
For that, you might have to use the BitBucket API like the commit/revision one.
That would bring back all the information you need about a specific commit.
So:
- either use git ls-remote to get the remote branch SHA1, plus the BitBucket API
- or use only BitBucket API calls in order to query the remote repo. (Like refs/branches to get those same remote branches names and SHA1)
With a repository already cloned, my old answer (which is the basis for this gist) is enough.
You can add a filter to print the data only for a specific branch.
Make a bash script called git-infob (no extension, works even on Windows) with:
#!/bin/bash
bname=$1
branches=$(git branch -r | grep -v HEAD)
for branch in ${branches}; do
branch_name=$(echo -n $branch | sed -e "s/origin\///g")
# echo ii ${branch_name} ${bname}
if [ "${bname}" == "${branch_name}" ]; then
git log -1 --format="%ai %ar by %an" $branch
fi
done
Put that script anywhere in your $PATH
/%PATH%
, and call git infob master
.