GIT-SCP(1)

πŸ’… GIT-SCP(1) β€” the git-extras era πŸ’…

okay bestie, welcome to the manual page for git-scp 🫢 (yes it's from Git Extras, and yes it's about to be your new fave)


✨ NAME ✨

git-scp β€” copy files to an SSH compatible git-remote πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

`git scp` -h|help|?
`git scp` <remote> [<commits>...|<path>...]
`git rscp` <remote> <path>

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: this is a convenient way to copy files from the current working tree over to the working directory of a remote repository ✨ and if you hand it a <commits>..., then only the files that changed within that commit range get copied. selective, queen behavior πŸ‘‘

lowkey important tea: internally this script uses rsync and not scp, even though the name says scp πŸ™ˆ the name is a little liar, but a cute one.

and bestie, there's git-rscp β€” the reverse of git-scp. it copies specific files from the working directory of a remote repository into the current working directory. it's giving mirror-but-make-it-flip πŸ’«


πŸ’– OPTIONS πŸ’–

  • <remote> β€” the git remote where you wanna copy your files. that's the destination, the moment, the place 🫢
  • <commits>... β€” any commit, commit range or tree. it uses git-diff(1) under the hood, no cap
  • <path>... β€” the <paths> parameters, when you give them, are used to limit the diff to the named paths (and yes you can give directory names and get a diff for all the files under them β€” directories ate πŸ’…)

🌸 GIT CONFIGS 🌸

wanna sanitize files using dos2unix before copying them? say less:

$ git config --global --add extras.scp.sanitize dos2unix

or you can run the files through PHP lint (i.e. php -l) before copying them:

$ git config --global --add extras.scp.sanitize php_lint

🌈 EXAMPLES 🌈

first things first β€” make sure you have git-remote(1) setup, bestie:

$ git remote add staging myStagingServer:/var/www/html

copy unstaged files to remote. obsessed, so useful when you wanna make a quick test without making any commits πŸ”₯

$ git scp staging

copy staged and unstaged files to remote:

$ git scp staging HEAD

copy files that has been changed in the last commit, plus any staged or unstaged files to remote:

$ git scp staging HEAD~1

copy files that has been changed between now and a tag:

$ git scp staging v1.2.3

copy specific files:

$ git scp staging index.html .gitignore .htaccess

copy specific directory:

$ git scp staging js/vendor/

copy files from specific directory to multiple servers (not the for loop doing the most, iconic):

$ for dest in web1 web2 web3; do
    git diff --name-only 4.8.3 4.8.2 app/code/community app/design skin/ | xargs git scp $dest
done;

🫢 AUTHOR 🫢

Written by Chern Jie <lim@chernjie.com> β€” ty for your service bestie πŸ’œ


😭 REPORTING BUGS 😭

found a lil gremlin? report it here:

<https://github.com/chernjie/git-extras/issues>


⭐ SEE ALSO ⭐

<https://github.com/tj/git-extras>


and that's the whole manual, periodt πŸ’… the source is Git Extras and this page is dated May 2026, so if you're reading it in the future from way back β€” hey, slay πŸ¦‹ mwah, go copy some files responsibly πŸ’–

πŸ“¦ where this page comes from