File: git-scp.md

package info (click to toggle)
git-extras 7.4.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 2,120 kB
  • sloc: sh: 4,312; python: 994; makefile: 146
file content (88 lines) | stat: -rw-r--r-- 2,354 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
git-scp(1) -- Copy files to SSH compatible `git-remote`
=======================================================

## SYNOPSIS

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

## DESCRIPTION

A convenient way to copy files from the current working tree to the working directory of a remote repository. If a `<commits>...` is provided, only files that has changed within the commit range will be copied.

Internally this script uses `rsync` and not `scp` as the name suggests. 

`git-rscp` - The reverse of `git-scp`. Copies specific files from the working directory of a remote repository to the current working directory.

## OPTIONS

  &lt;remote&gt;

    The git remote where you want to copy your files.

  &lt;commits&gt;...

    Any commit, commit range or tree. Uses `git-diff`(1)

  &lt;path&gt;...

    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).

## GIT CONFIGS

 To sanitize files using `dos2unix` before copying files

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

 You can run the files through PHP lint (i.e. `php -l`) before copying files

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

## EXAMPLES

 Make sure you have `git-remote`(1) setup

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

 Copy unstaged files to remote. Useful when you want to make 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

    $ 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 &lt;<lim@chernjie.com>&gt;

## REPORTING BUGS

&lt;<https://github.com/chernjie/git-extras/issues>&gt;

## SEE ALSO

&lt;<https://github.com/tj/git-extras>&gt;