简体   繁体   中英

How do I watch a local Git repo for head changes?

I am working on a project which requires me to watch a git repo for any head changes ie any git commits, branch changes etc.

Is there any library or nuget to do this programmatically (in .NET)? If not, any suggestions for possible approaches to do this?

You can use a FileSystemWatcher to monitor a local .git/refs folder for changes. You can use libgit2sharp if you need to understand what changed. Monitoring a remote git server will either require some kind of hook script, or polling the repository on a timer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM