I'm writing an external Git plugin. It should process commits in Git and create some entity in another system if commit contains some text. Note that I want to search through all entire repository, not some branch. Also I have storage in my plugin, so I can store some revision SHA for example
I clone Git repository locally and fetch it periodically. During fetch I want to discover which new commits were added since last synchronization. Is there any easy way to do this?
One solution is to create local branches, and after fetch discover the difference between local branch and origin branch. But what to do if there was forced update on remote branch? In that case difference can be huge, and the same commits can be processed twice. Also if I will use local branches solution, and new branch is added on remote server, I definitely do not want to process all commits in new branch, just the unique one.
Git 'fetch' command definitely can do this. So I hope there is some easy way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With