From fdde3a49d44e7e1404d7665880158a5b84c3dcad Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 6 May 2026 09:54:00 +0200 Subject: Add GIT_REMOTE, GIT_BRANCH config options and --push flag - GIT_REMOTE in config auto-registers origin on every run (idempotent) - GIT_BRANCH sets push target branch (defaults to current branch) - -p/--push pushes after commit; errors if no remote available - Updated config.example and README Co-Authored-By: Claude Sonnet 4.6 --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index fa59028..1a5f0ed 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ git push -u origin master -v, --verbose Print each file as rsync transfers it -r, --restore Restore dotfiles from backup to original locations -q, --quiet Suppress stdout; write output to log instead + -p, --push Push to remote after commit -h, --help Show this help ``` @@ -82,12 +83,20 @@ Or automate with cron (silent, logs to `~/.local/share/dot-backup/backup.log`): 0 * * * * /path/to/dot-backup.sh -q ``` -After backup, push manually: +Push manually after backup: ```bash cd ~/Programming/GIT/my-dotfiles && git push ``` +Or set `GIT_REMOTE` in config and use `-p` to push automatically: + +```bash +./dot-backup.sh -p +# or combined with cron: +./dot-backup.sh -q -p +``` + ## Restoring on a New Machine Preview what would be restored first: @@ -118,8 +127,12 @@ Available options: DEFAULT_OUTPUT_DIR="${HOME}/Programming/GIT/my-dotfiles" LOG_FILE="${HOME}/.local/share/dot-backup/backup.log" DOTFILES_LIST="${HOME}/.config/dot-backup/files.list" +GIT_REMOTE="git@github.com:you/my-dotfiles.git" +GIT_BRANCH="master" ``` +`GIT_REMOTE` — if set, script ensures it is registered as `origin` on every run. Required for `--push`. `GIT_BRANCH` defaults to the current branch if unset. + ## Adding Files **Edit the script** — add paths to the `DOTFILES` array in `dot-backup.sh`. -- cgit v1.2.3