偶而會有一個資料夾想要一直寫東西然後存檔後自動 push 到 git 上面的需求
於是寫了以下 script ,不過寫完後才發現,這樣會弄髒 commit log ,反而是不實用 lol
純練習
#!/usr/bin/perl use 5.014; my $dir = $ARGV[0] // `pwd`; chdir $dir; say "start auto commit under: " . `pwd`; while (1) { my $diff = `git diff`; if ($diff) { my $t = `date +"%F [%T]"`; `git add .`; `git commit -m "auto commit @ $t"`; `git push`; } sleep 10; }
No comments:
Post a Comment