This is an amazing small tool, which automates your usage of GIT. On every file change it creates a commit and pushes it to your remote GIT repository.
Clone the watchman
project from Facebook Link
git clone https://github.com/facebook/watchman
Build and install watchman
cd watchman
./autogen.sh
./configure
make
make install
Test if watchman
is correctly installed in your PATH
which watchman
Should return something like
/usr/local/bin/watchman
Just define your start script, let's say we name it start-watchman.sh
:
#!/bin/bash
watchman watch ~/projects/git-autocommit
watchman -- trigger ~/projects/git-autocommit auto-commit '*' -- ./auto-commit.sh
As you can see, we just use our own GitHub project git-autocommit
to demonstrate how it works.
With watchman
we just start a trigger
command, which will be fired every time a single file
is changed within our directory structure. That's all.
And here is the damned simple auto-commit.sh
script:
#!/bin/bash
git add --all
git commit -am "Changed file $*, Auto-Commit V0.1"
git push
Now, let's start the show:
./start-watchman.sh
Hey guys, that's all. Just simply use it.
Ok, it's not completed nor perfect right now. But I think it's a good starting point.
And once again, this GitHub project I've just created and edited while an active watchman
was running my auto-commit.sh
script.
On every single file save from my editor, I'm instantly getting a new commit pushed automatically to the remote GitHub repository.
Thanks to this great article I found yesterday about the functions of watchman
and how it could help to easily
automate even single tasks of a developers life.
Watchman: Faster builds with large source trees, by Wez Ferlong.
The MIT License (MIT)
Copyright (c) 2013 Dieter Reuter