15-03-2019
This commit is contained in:
@@ -125,6 +125,69 @@ Crée un clone du depot dans le dossier mondossier
|
||||
|
||||
|
||||
|
||||
#### Tirer un seul fichier d'un repo git:
|
||||
|
||||
```bash
|
||||
$ mkdir rpi_py
|
||||
$ git init
|
||||
Dépôt Git vide initialisé dans /home/pi/git/rpi_py/.git/
|
||||
$ git remote add origin bruno@dsm916e:/volume1/Repositories/rpi_py.git
|
||||
$ git fetch
|
||||
bruno@clicclac.synology.me's password:
|
||||
remote: Enumerating objects: 38, done.
|
||||
remote: Counting objects: 100% (38/38), done.
|
||||
remote: Compressing objects: 100% (38/38), done.
|
||||
remote: Total 38 (delta 5), reused 0 (delta 0)
|
||||
Dépaquetage des objets: 100% (38/38), fait.
|
||||
Depuis dsm916e:/volume1/Repositories/rpi_py
|
||||
* [nouvelle branche] master -> origin/master
|
||||
$ git checkout origin/master -- Camera/camera_2.py
|
||||
|
||||
pi@litePi:~/git/rpi_py $ cd Camera/
|
||||
total 12
|
||||
drwxr-xr-x 2 pi pi 4096 févr. 4 16:45 .
|
||||
drwxr-xr-x 4 pi pi 4096 févr. 4 16:45 ..
|
||||
-rw-r--r-- 1 pi pi 238 févr. 4 16:45 camera_2.py
|
||||
```
|
||||
|
||||
Autre solution (juste le fichier, pas l'historique):
|
||||
|
||||
```bash
|
||||
$ git archive --format=tar --remote=ssh://bruno@dsm916e/volume1/Repositories/rpi_py.git heads/master -- Camera/camera_2.py | tar xf -
|
||||
|
||||
# affiche le fichier sur la sortie stdout (tar -xO)
|
||||
$ git archive --format=tar --remote=ssh://bruno@dsm916e/volume1/Repositories/rpi_py.git heads/master -- Camera/camera_2.py | tar -xO
|
||||
bruno@clicclac.synology.me's password:
|
||||
import time
|
||||
import picamera
|
||||
|
||||
with picamera.PiCamera() as camera:
|
||||
camera.resolution = (1024, 768)
|
||||
camera.start_preview()
|
||||
# Camera warm-up time
|
||||
time.sleep(2)
|
||||
camera.capture('/home/pi/Desktop/foo.jpg', resize=(320, 240))
|
||||
```
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
|
||||
# -n : No checkout of HEAD is performed after the clone is complete.
|
||||
# --depth 1 : juste la dernière révision
|
||||
$ git clone -n ssh://bruno@dsm916e/volume1/Repositories/rpi_py.git --depth 1
|
||||
Clonage dans 'rpi_py'...
|
||||
...
|
||||
$ cd rpi_py/
|
||||
$ git checkout HEAD Camera/camera_2.py
|
||||
```
|
||||
|
||||
Voir aussi https://gist.github.com/ssp/1663093
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Enregistrer des modifications dans le dépôt:
|
||||
|
||||
#### [Vérifier l'état des fichiers](https://git-scm.com/book/fr/v1/Les-bases-de-Git-Enregistrer-des-modifications-dans-le-d%C3%A9p%C3%B4t#V%C3%A9rifier-l'%C3%A9tat-des-fichiers)
|
||||
|
||||
Reference in New Issue
Block a user