Since git fetch
doesn't make any changes and it just updates the references and keeps the tracking branches up to date with the remote branches (like it says if it's ahead and/or behind).
I can see that it is really important to know whats going on on the remote repo.
If git fetch is not destructive. Why doesn't git just run a git fetch periodically whenever there is an internet connection?
Is it good practice to make a script that does that for me?
Essentially, what it boils down to is that Git provides a set of tools for you but leaves the rest of the details of how you actually use it up to the unique circumstances of the user.
This is why other projects such as git-flow have come about, that go that bit further and provide a tried and tested workflow that may work for a large number of users.
If you want to fetch regularly by all means write a cron that does so. That's where the power of git comes in - it's a solid set of tools and if you want to extend it in some way you can.
However, perhaps it's not such a good idea. How often is periodically? If you're about to push and your script last fetched a minute before a colleague pushed to the same branch, then it would reject your push and you'd have to fetch, pull, merge, rebase, etc. anyway.
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