Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't git run a git fetch periodically?

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?

like image 781
user3571278 Avatar asked Sep 28 '22 18:09

user3571278


1 Answers

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.

like image 112
bcmcfc Avatar answered Oct 13 '22 20:10

bcmcfc