Justintime50 / github-archive

A powerful tool to concurrently clone, pull, or fork user and org repos and gists to create a GitHub archive.
MIT License
186 stars 48 forks source link

Clone if repo doesn't exist / pull if it exists #57

Closed JonasGruenwald closed 1 year ago

JonasGruenwald commented 1 year ago

Hey! Love this tool, works great for cloning all my repos, I have a question though – I would like to use this as a way to mirror all my repositories on a server, so I would set up a cron job to periodically run it into the same directory. I can see there are separate flags for clone and pull, but for my scenario I imagine it would be ideal to have it clone only repositories that don't exist in the directory, and pull any repository that already exist. Is that something that's already possible and I'm just missing something and if not, would you consider it in scope for your tool / would you accept a PR?

Justintime50 commented 1 year ago

Hey @JonasGruenwald thanks for the issue! Yes, you can already do this. By passing the --clone and --pull flags together, it will clone repos that don't exist and pull ones that do. I use both flags personally on a daily cron to keep a complete up-to-date copy of all my repos. Give it a try and let me know if you need anything else. I'll wait to hear back before closing this issue.

JonasGruenwald commented 1 year ago

Oh that's fantastic yeah, exactly what I had in mind, thank you very much!