Reputation: 1
There is a remote GitHub repository where everyone makes changes to files, raises PR and updates it regularly. I have the same repository in my local. Right now am doing git pull manually whenever I see changes in the remote repository. Instead of manually doing it every time, I just want whatever the changes that are happening in the remote repository to automatically replicate in my local via a python API if possible.
I wanted to know if it is possible for a python script to automatically detect changes whenever there is a change/development in the corresponding remote GitHub repository and update those changes at a certain time in the local folder. So that I don't have to keep doing a manual git pull operation whenever I see changes in the remote GitHub repository.
Upvotes: 0
Views: 745
Reputation: 46
Automating git pull
is a bad idea because it would fail whenever there is a conflict.
Some people use cron jobs for running git fetch
implicitly in the background, but it introduces other complications that you might not want to deal with. From the docs:
A general note on safety: supplying this option without an expected value, i.e. as
--force-with-lease
or--force-with-lease=<refname>
interacts very badly with anything that implicitly runsgit fetch
on the remote to be pushed to in the background, e.g.git fetch origin
on your repository in a cronjob.
Upvotes: 1