0

I'm new to using Git and I made some research and discovered that I can run cron jobs to make my commits into my repository every certain time, my question here is.

Can I create a cron job that runs every Friday at 16:00?

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
Eduardo Ortiz
  • 715
  • 3
  • 14
  • Git isn't really relevant here: cron will run *anything* you ask it to, whether that's `git`, or `ls`, or `mail`, or `reboot`. What happens when that command runs is up to that command; whether running that command regularly, at some given time, is a good idea, is up to you. – torek Sep 28 '21 at 20:58
  • Thank you for the heads up, as I said I'm new into git and needed some clarification. – Eduardo Ortiz Sep 28 '21 at 21:06

1 Answers1

0

It's not a good practice to do so.

Let's assume that you write a script that executes

git add . && \ 
git commit -m ... && \
git pull

Those commands will add the content and commit them to git.

Once you will try to push your code it will work as long as you won't have any conflicts. in case of conflicts, git will not know how to resolve the conflicts and you will start a mess in your repository.


Example:

Lets assume that you will run into this conflict:

enter image description here

how do you expect git to resolve it?


Just to make it clear: You can auto-resolve conflicts in several ways but it's not a healthy practice so you should avoid doing so.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • 1
    Thank you for clarifying a lot of things that I didn't know, then I'll avoid this and run my commits whenever I do major changes :D – Eduardo Ortiz Sep 28 '21 at 21:04