Making git auto-commit

前端 未结 18 1803
面向向阳花
面向向阳花 2020-11-27 08:41

I\'d like to use git to record all the changes to a file.

Is there a way I can turn git \'commit\' on to automatically happen every time a file is updated - so ther

18条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 09:31

    The previous answers recommending inotifywait for this job tipped me off in the right direction when I had this problem myself, so I wrote a little script. First this could only watch whole folders recursively (the opposite of Lester Buck's example), but then I also wanted to watch a file somewhere else, so I expanded it.

    The result is a script currently called gitwatch, as that is what it does: it watches a file or folder for changes (using inotifywait), and commits them to a git repository.

    You can find the script, more info and instructions over on github: https://github.com/nevik/gitwatch

提交回复
热议问题