Skip to content

Instantly share code, notes, and snippets.

@wsdookadr
Forked from hhutch/fetch-repos.sh
Created September 30, 2018 19:22
Show Gist options
  • Save wsdookadr/df17e07f7a84d25d7fe2d12525d76b41 to your computer and use it in GitHub Desktop.
Save wsdookadr/df17e07f7a84d25d7fe2d12525d76b41 to your computer and use it in GitHub Desktop.
find file changes in all forks of a github repo
curl -i https://api.github.com/repos/scrooloose/nerdtree/forks |grep -e "git_url" |awk '{gsub(/,/,"");split($2,a,"/"); system("mkdir "a[4]"; cd "a[4]"; git clone " $2);}'
DIRS=$(find * -type d -name '*nerdtree' -maxdepth 1 -print)
FILECHANGE="plugin/NERD_tree.vim"
for d in $DIRS
do
cd $d
git fetch
BRANCHES=$(git branch -a)
OBS=$(git branch -r |egrep -v '(HEAD)')
for ob in $OBS
do
git checkout -t $ob 2>/dev/null
bonly=$(echo $ob |awk {'split($0,a,"/"); print a[2]'})
git checkout $bonly &>/dev/null
git pull &>/dev/null
out=$(git log --pretty=format:"%H %ad" $FILECHANGING |head -n1 | xargs -I{} echo `pwd`"("$ob"): "{})
echo $out
done
cd ../..
done
#1 mkdir $working_dir; echo "modify fetch-repos.sh for your source repo"; cd $working_dir; bash fetch-repos.sh;
#2 echo "modify find-file-changes.sh to use the file you need"; cd $working_dir; bash find-file-changes.sh > all-branch-changes.txt
#3 cat all-branch-changes.txt |sort -k4M,7
This will output a list of fork:branche:commit for a specific file sorted by date of commit;
Note: this is kind of brittle and could break depending on the input data (ie the names of things in the repositories).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment