1GIT-SCP(1)                        Git Extras                        GIT-SCP(1)
2
3
4

NAME

6       git-scp - Copy files to SSH compatible git-remote
7

SYNOPSIS

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

DESCRIPTION

14       A  convenient  way  to  copy files from the current working tree to the
15       working directory of a remote repository. If  a  <commits>...  is  pro‐
16       vided,  only  files  that  has  changed within the commit range will be
17       copied.
18
19       Internally this script uses rsync and not scp as the name suggests.
20
21       git-rscp - The reverse of git-scp. Copies specific files from the work‐
22       ing directory of a remote repository to the current working directory.
23

OPTIONS

25       <remote>
26
27
28
29           The git remote where you want to copy your files.
30
31
32
33       <commits>...
34
35
36
37           Any commit, commit range or tree. Uses `git-diff`(1)
38
39
40
41       <path>...
42
43
44
45           The <paths> parameters, when given, are used to limit the diff to the named paths (you can give directory names and get diff for all files under them).
46
47
48

GIT CONFIGS

50       To sanitize files using dos2unix before copying files
51
52
53
54           $ git config --global --add extras.scp.sanitize dos2unix
55
56
57
58       You  can  run  the  files through PHP lint (i.e. php -l) before copying
59       files
60
61
62
63           $ git config --global --add extras.scp.sanitize php_lint
64
65
66

EXAMPLES

68       Make sure you have git-remote(1) setup
69
70
71
72           $ git remote add staging myStagingServer:/var/www/html
73
74
75
76       Copy unstaged files to remote. Useful when you want to make quick  test
77       without making any commits
78
79
80
81           $ git scp staging
82
83
84
85       Copy staged and unstaged files to remote
86
87
88
89           $ git scp staging HEAD
90
91
92
93       Copy files that has been changed in the last commit, plus any staged or
94       unstaged files to remote
95
96
97
98           $ git scp staging HEAD~1
99
100
101
102       Copy files that has been changed between now and a tag
103
104
105
106           $ git scp staging v1.2.3
107
108
109
110       Copy specific files
111
112
113
114           $ git scp staging index.html .gitignore .htaccess
115
116
117
118       Copy specific directory
119
120
121
122           $ git scp staging js/vendor/
123
124
125
126       Copy files from specific directory to multiple servers
127
128
129
130           $ for dest in web1 web2 web3; do
131               git diff --name-only 4.8.3 4.8.2 app/code/community app/design skin/ | xargs git scp $dest
132           done;
133
134
135

AUTHOR

137       Written by Chern Jie <lim@chernjie.com>
138

REPORTING BUGS

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

SEE ALSO

143       <https://github.com/tj/git-extras>
144
145
146
147                                 October 2017                       GIT-SCP(1)
Impressum