I'd like to use git to keep a simple history of changes to some text files (source but could be config files or anything - the Q isn't specific to s/w development).

I used to use RCS for this, which was as simple as having a job which ran daily, which found all my relevant text files (e.g. cd /some/where; find . -name "*.foo" ...) and checked them all in (something like ci -q -mbackup -l filename) - ci essentially does nothing if the file is unchanged. The old versions (or more accurately diffs from which the old versions could be reconstructed by rcs) were held in an RCS directory in the local file-system/disk.

At a later time I could run rlog filename to see the dates on which a file of interest had been altered and the number of lines changed. I could use rcsdiff to see the exact changes made, if need be. I could use co to revert changes.

I have no need for remote repos, syncing repos, working with other people, keeping logs of reasons for changes, branching, grouping files together, stamping version numbers or release numbers on groups of files or any other thing than basic file versioning (without using Windows 10's built in features which talks about needing an external disk and which I am suspicious of on portability grounds).

I already have git installed on Windows 10 (because golang uses git to fetch libraries etc, I don't use git directly myself) so ...

Is there a simple way to use git in a similar simplistic fashion?


Sure. You'll need some kind of script that cd's into /some/where, and then runs something along the lines of

git add .
git commit -m "some message"

Then you can use git log $filename to see it's history. git log won't show you the numbers changed, but you could script the generation of your commit message to reflect that. And git diff to show you the exact changes and git revert to revert.


Covering some simple equivalents of the items in your question, and assuming that you have all files of interest under /some/where

One time initialization:

cd /some/where
git init

Commit all foo files changed since the last commit:

cd /some/where
git add "*.foo"
git commit -m "commit message about today's foo files"

List most recent three commits of a particular file, with summary stats:

cd /some/where/else
git log -3 --shortstat alphabet.foo

Given two commit hashes from the git log output, see the diff between them

cd /some/where/else
git diff ac132f..be8d5e alphabet.foo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.