Coder Social home page Coder Social logo

makifves / gwatch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jw0k/gwatch

0.0 0.0 0.0 5.2 MB

Watches a folder for file modifications and commits them to a git repository automatically

License: MIT License

Shell 0.19% JavaScript 0.01% C++ 0.93% Python 0.51% C 96.96% PHP 0.06% Objective-C 0.15% PowerShell 0.05% Makefile 0.20% HTML 0.03% CMake 0.64% Batchfile 0.14% M4 0.15%

gwatch's Introduction

gwatch

A program that watches a folder for file modifications and commits them to a git repository automatically

How gwatch works

After gwatch is started it will watch a given folder and all of its subfolders (recursively) for changes. If a change occurs, a timer will be started (30s by default). After the timer expires, gwatch will create a new git commit with all the modifications. The timer is to prevent creating too many commits when there are a lot of modifications. In order for gwatch to successfully create commits, a git repository must be initialized in the watched folder.

Gwatch works on Linux and on Windows.

Download

Head to the releases section to download Windows executable file. That single exe file is all you need to run gwatch. On Linux you will have to compile it yourself. See further for instructions.

Use cases

Gwatch can be used to track changes or backup files. E.g.:

  • you are working on a document, an image file or a song and the software you are using does not support tracking of the changes. Gwatch will commit every time you save your work. This way you can go back to previous versions of your work using standard git commands.
  • you are playing a game that keeps your progress in a save folder. If your save files become corrupted most of the time you will lose all your progress. Gwatch will protect you against such situation.

Using gwatch

You will need to install git first if not already installed. Follow these steps to use gwatch:

  • make sure there is a git repository initialized in the folder you want to watch; if not run git init from the command prompt or terminal.
  • on Windows you can just copy and paste the gwatch.exe file to that folder and run it. On Linux type ./gwatch -r /path/to/watch

That's it. Gwatch will start, watch the folder and create commits when necessary.

If you want you can also specify the timeout in seconds like this:

./gwatch -r /path/to/watch -t 5 (on Linux)

gwatch.exe -r C:\path\to\watch -t 5 (on Windows)

Lower values will result in a lot of created commits if changes happen often. If you omit the -t argument, gwatch will use the default 30s timeout.

Important notes

  • Make sure you are checked out on some branch. Gwatch will commit to that branch. If you are in detached HEAD state, gwatch will refuse to commit.

Compiling on Windows

To compile on Windows you will need CMake 3.15 or newer and Visual Studio 2019. Earlier versions should work too but haven't been tested. Follow these steps:

  • create a folder named build in the project's root
  • open the command prompt in that folder and run:
  • cmake .. -A Win32
  • cmake --build . --config Release

By default the binary will be linked against static run-time library (/MT option for MSVC).

Compiling on Linux

To compile on Linux you will need CMake 3.15 and a C compiler (e.g. GCC or Clang). Run:

  • mkdir build
  • cd build
  • cmake .. -DCMAKE_BUILD_TYPE=Release
  • cmake --build .

gwatch's People

Contributors

jw0k avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.