Monday, April 13, 2020

analyze each commit in a repo

$ git --no-pager log --pretty=format:"%H %ad" > hash_and_date.log
$ cat hash_and_date.log | wc -l
     538

mkdir -p /tmp/my_bundle

cp hash_and_date.log /tmp/my_bundle/



$ git branch -a
* gh-pages
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/gh-pages
  remotes/origin/haskell
  remotes/origin/master
  remotes/origin/mike
  remotes/origin/test_branch

$ git bundle create pdg.bundle gh-pages
Enumerating objects: 6317, done.
Counting objects: 100% (6317/6317), done.
Delta compression using up to 4 threads
Compressing objects: 100% (5936/5936), done.
Writing objects: 100% (6317/6317), 92.21 MiB | 11.46 MiB/s, done.
Total 6317 (delta 3369), reused 150 (delta 68)
$ ls -hal pdg.bundle 
    92M Apr 13 11:44 pdg.bundle

$ cp pdg.bundle /tmp/my_bundle/
$ cd /tmp/my_bundle/
$ git clone --no-checkout pdg.bundle 
Cloning into 'pdg'...
Receiving objects: 100% (6317/6317), 92.21 MiB | 51.80 MiB/s, done.

Resolving deltas: 100% (3369/3369), done.

see https://gist.github.com/bhpayne/fb63fa0816be63733488162baebf9b14
for lcount function

$ while read -r line; do this_hash=`echo $line | cut -d' ' -f1`; this_date=`echo $line | cut -d' ' -f3-`; rm -rf *; git checkout $this_hash; lcount $this_hash "$this_date" >> ../record.log; done < ../hash_and_date.log

No comments:

Post a Comment