Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 6670  / 2 Years ago, tue, june 28, 2022, 8:10:38

I've found some nice questions illustrating how one would write a script automating git push/pull with cron here and here, but I want to elaborate on that slightly. I only want to push/pull if there were changes made that day.



I basically want the script to check the difference log between origin and this repository and only push or pull if there are changes. I'm not very experienced with bash and git, so I don't really know where to start, otherwise I would paste what I've tried so far.



Thank you for any help or guidance.


More From » bash

 Answers
2

git push and git pull change your files only when there are differences.



if you try to git add --all when there's no changes, it won't add anything,
the subsequent git commit -m "" and git push will have no effect also.



the script you referred should work properly.



if you want extra checks you can do git remote update then git diff to see the difference before merging the local files.


[#22864] Tuesday, June 28, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lowovey

Total Points: 287
Total Questions: 98
Total Answers: 117

Location: Bosnia and Herzegovina
Member since Thu, Jan 14, 2021
3 Years ago
;