Skip to content

feat(scp): add verbose, interactive, and dry-run flags#1261

Merged
spacewander merged 5 commits into
tj:mainfrom
anderewrey:anderewrey/scp-verbosity
Jul 14, 2026
Merged

feat(scp): add verbose, interactive, and dry-run flags#1261
spacewander merged 5 commits into
tj:mainfrom
anderewrey:anderewrey/scp-verbosity

Conversation

@anderewrey

Copy link
Copy Markdown
Contributor

Adds -v/--verbose, -i/--interactive, and -n/--dry-run to git scp/git rscp.

  • -v prints the diff (or an rsync preview) before syncing, via --no-pager so it can't block on the pager like the current unconditional git diff does.
  • -i also prompts for confirmation before the real push/copy.
  • -n previews with no changes made (implies -v).
  • Default behavior (silent, real sync) is unchanged, so existing batch-loop usage isn't affected.
  • Flags must precede <remote>.

git scp/git rscp printed a diff via plain `git diff`/`git diff --stat`
with no `--no-pager` and no TTY check, blocking on the user's pager.
Add -v/--verbose to print the diff via --no-pager before syncing, and
-i/--interactive to also prompt for confirmation before the real
push/copy. Both apply to git scp and git rscp, and must precede
<remote>.

Updates man/git-scp.md and Commands.md.
Add -n/--dry-run to preview a sync without changing anything: rsync
runs with -n, and git add --force / ssh ... rm are skipped outright.
Implies --verbose, since confirming or previewing with nothing shown
is useless.

Also restructures scp_and_stage's push/delete blocks from `&&`-chains
into if/then, needed to branch on dry-run, which incidentally fixes a
latent bug where a non-TTY COLOR_RESET could silently skip the real
rsync/git add/ssh rm calls.

Updates man/git-scp.md and Commands.md.
git-scp had no test coverage at all. Cover the two paths that need no
real remote destination: dry-run must preview without touching the
index, working tree, or remote path, and declining the interactive
confirmation must abort before anything syncs.
Comment thread bin/git-scp Outdated
Comment thread bin/git-scp
Comment thread bin/git-scp Outdated
Comment thread bin/git-scp Outdated
@spacewander
spacewander merged commit 5a14757 into tj:main Jul 14, 2026
6 checks passed
@spacewander

Copy link
Copy Markdown
Collaborator

@anderewrey
Merged. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants