1

Is there any way to have the full source code repo after each commit?

I mean for example using

https://api.github.com/repos/highcharts/highcharts/commits

would give me a list of commits, but I want to realize what was the effect of that commit to whole repo (I want to check whether any code duplication is added to whole project or not using some automatic tools). Is that possible?

I want to see the code effect, so having repo even after merging each commit would be fine.

hsbr13
  • 431
  • 1
  • 8
  • 21

1 Answers1

0

Simply implement a listener to a webhook (see "Creating a Webhook"). Set it up to ball your listener at each push event.

You can then do a pull when called by the webhook, and get a fresh updated copy of the repo locally.


For other repos you don't have any control or whose owner is in your team, that webhook approach is not possible.

You would need to implement a scheduled polling approach, through a regular cron job for instance.
That would possible multiple commits, so you need to wrap that pull with a git log as in here.

git checkout master
git fetch
refs=$(git log --format='%H' ..origin/master)
for ref in ${refs}; do
  # do your analysis commit by commit
done
git merge origin/master
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • It seems that I can set up webhook on my own projects, is it right? – hsbr13 Aug 12 '18 at 05:09
  • @hsbr13 Yes. Are you talking about other repos you don't have any control or whose owner is in your team? – VonC Aug 12 '18 at 08:01
  • yes, I want to analyze the commits on a large project (like highcharts I said) for some academic uses. Is it possible? – hsbr13 Aug 12 '18 at 08:27