Skip to main content

Simple tracking of your home directory with easy-to-read diffs.

Project description

Simple home directory versioning

This is a conversion of my simple scripts to version my home directory with very specific excludes and formatting every file upon commit so that readable diffs can be generated.

Installation

pip install baldwin

Usage

 $ bw -h
Usage: bw [OPTIONS] COMMAND [ARGS]...

  Manage a home directory with Git.

Options:
  -d, --debug  Enable debug logging.
  -h, --help   Show this message and exit.

Commands:
  auto-commit
  format
  git
  info
  init
  install-units

In addition to the bw command, hgit is a shortcut for bw git.

Start a new repository

bw init

Find out where the bare Git directory is by running bw info. This can be done even if init has not been run.

Automation

systemd

bw install-units

This will install a timer that will automatically make a new commit every 6 hours. It does not push.

Keep in mind that systemd units require a full path to the executable, so you must keep the unit up-to-date if you move where you install this package. Simply run bw install-units again.

Note that user systemd units only run while logged in.

To disable and remove the units, use the following commands:

systemctl disable --now home-vcs.timer
rm ~/.config/systemd/user/home-vcs.*

Pushing

To push, use either of the following:

  • bw git push
  • hgit push

The above also demonstrates that bw git/hgit are just frontends to git with the correct environment applied.

Formatting

If Prettier is installed, it will be used to format files. The configuration used comes with this package. Having consistent formatting allows for nice diffs to be generated.

If you have initialised a repository without having prettier or jq in PATH, you need to run the following commands to enable readable diffs:

hgit config diff.json.textconv 'jq -MS .'
hgit config diff.json.cachetextconv true
hgit config diff.yaml.textconv 'prettier --no-editorconfig --parser yaml'
hgit config diff.yaml.cachetextconv true

If you have the XML plugin installed:

hgit config diff.xml.textconv 'prettier --no-editorconfig --parser xml --xml-whitespace-sensitivity ignore'
hgit config diff.xml.cachetextconv true

Binary files

Any file that is untracked and detected to be binary will not be added. Use hgit add to add a binary file manually.

Other details

Default .gitignore and .gitattributes files are installed on initialisation. They are never modified by this tool. Please customise as necessary.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

baldwin-0.0.2.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

baldwin-0.0.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file baldwin-0.0.2.tar.gz.

File metadata

  • Download URL: baldwin-0.0.2.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-gentoo-limelight

File hashes

Hashes for baldwin-0.0.2.tar.gz
Algorithm Hash digest
SHA256 190bb03e52102d38dca73eace898d01f901542de2197c2b3bc54918488a292f4
MD5 6188dd140990dd134f8a0b0ea2e39e95
BLAKE2b-256 642108d1319ef5ff222bbcfd53017f88086971c5b7baa7eb5f56e2e32be91580

See more details on using hashes here.

File details

Details for the file baldwin-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: baldwin-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-gentoo-limelight

File hashes

Hashes for baldwin-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c87b30da5c41ec21217b03fde5a46dbd6e09cbaedb1eb78d221c254caae0fcaf
MD5 a1689709cddd4f7f310d5b9ced72e77b
BLAKE2b-256 d32bfd3e9c70b43695685a85098e25fcf41001b9ff1f96f22024538c41eafe19

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page