Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
56-tools:git [2019/02/12 08:54] – [Exemple] Roge | 56-tools:git [2023/12/13 01:08] (Version actuelle) – [Créer un repository bare] Roge | ||
---|---|---|---|
Ligne 65: | Ligne 65: | ||
Avantage : l' | Avantage : l' | ||
+ | |||
+ | |||
+ | ===== Intialiser le remote à partir du local ===== | ||
+ | |||
+ | <code bash> | ||
+ | # Crée l' | ||
+ | git init < | ||
+ | |||
+ | # dans le dossier local racine | ||
+ | git remote add origin <URL> | ||
+ | # mise à jour de l' | ||
+ | git push origin master | ||
+ | # Tous les autres utilisateurs peuvent alors se synchroniser avec l' | ||
+ | git pull | ||
+ | </ | ||
===== Configuration ===== | ===== Configuration ===== | ||
Ligne 146: | Ligne 161: | ||
Afficher la liste des fichiers d'un projet : | Afficher la liste des fichiers d'un projet : | ||
- | '' | + | '' |
Suppression définitive d' | Suppression définitive d' | ||
Ligne 202: | Ligne 217: | ||
# Création du dossier de référence avec initialisation Git --bare | # Création du dossier de référence avec initialisation Git --bare | ||
# | # | ||
- | hal:/data $ cd /bkp/GITs/ hal:/ | + | hal:/data $ cd / |
- | $ git init Test-Git --bare Initialized empty Git repository in / | + | hal:/ |
+ | Initialized empty Git repository in / | ||
hal:/ | hal:/ | ||
- | $ cd Test-Git/ hal:/ | + | $ cd Test-Git/ |
- | $ echo " | + | hal:/ |
- | $ ll | + | hal:/ |
total 8 drwxr-xr-x 7 roge roge 4096 Nov 9 09:08 .git -rw-r--r-- 1 roge roge 3 Nov 9 09:10 test.txt | total 8 drwxr-xr-x 7 roge roge 4096 Nov 9 09:08 .git -rw-r--r-- 1 roge roge 3 Nov 9 09:10 test.txt | ||
# | # | ||
Ligne 214: | Ligne 230: | ||
hal:/ | hal:/ | ||
On branch master Initial commit | On branch master Initial commit | ||
- | Untracked files: (use "git add < file> | + | Untracked files: (use "git add < file> |
- | to include in what will be committed) test.txt nothing added to commit but untracked files present (use "git add" to track) | + | test.txt nothing added to commit but untracked files present (use "git add" to track) |
# | # | ||
Ajout dans Git | Ajout dans Git | ||
Ligne 221: | Ligne 237: | ||
hal:/ | hal:/ | ||
hal:/ | hal:/ | ||
- | On branch master Initial commit Changes to be committed: (use "git rm --cached < file> | + | On branch master Initial commit Changes to be committed: |
+ | (use "git rm --cached < file> | ||
# | # | ||
# Commit | # Commit | ||
Ligne 227: | Ligne 244: | ||
hal:/ | hal:/ | ||
[master (root-commit) 95defef] v1 1 file changed, 1 insertion( ) create mode 100644 test.txt | [master (root-commit) 95defef] v1 1 file changed, 1 insertion( ) create mode 100644 test.txt | ||
- | # Vérification hal:/ | + | # Vérification |
+ | hal:/ | ||
+ | 2016-11-09 12:38 (HEAD -> master) dd4b48d roge v1.1 | ||
+ | 2016-11-09 09:10 95defef roge v1 | ||
# | # | ||
Mise à jour du repository de reference | Mise à jour du repository de reference | ||
# | # | ||
hal:/ | hal:/ | ||
- | master Counting objects: 3, done. Writing objects: 100% (3/3), 197 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) To / | + | master Counting objects: 3, done. Writing objects: 100% (3/3), 197 bytes | 0 bytes/s, done. |
+ | Total 3 (delta 0), reused 0 (delta 0) To / | ||
+ | * [new branch] master -> master | ||
# Vérification | # Vérification | ||
hal:/ | hal:/ | ||
hal:/ | hal:/ | ||
$ git log | $ git log | ||
- | 2016-11-09 12:38 (HEAD -> master) dd4b48d roge v1.1 2016-11-09 09:10 95defef roge v1 | + | 2016-11-09 12:38 (HEAD -> master) dd4b48d roge v1.1 |
+ | 2016-11-09 09:10 95defef roge v1 | ||
# | # | ||
# Modification du fichier et commit | # Modification du fichier et commit | ||
# | # | ||
- | hal:/ | + | hal:/ |
- | $ git status On branch master Changes not staged for commit: (use "git add < file> | + | hal:/ |
- | $ git add * | + | On branch master |
+ | Changes not staged for commit: (use "git add < file> | ||
+ | to update what will be committed) (use "git checkout -- < file> | ||
+ | to discard changes in working directory) | ||
+ | modified: test.txt no changes added to commit (use "git add" and/or "git commit -a" | ||
+ | hal:/ | ||
hal:/ | hal:/ | ||
- | [master dd4b48d] v1.1 1 file changed, 1 insertion( ), 1 deletion(-) | + | [master dd4b48d] v1.1 1 |
+ | file changed, 1 insertion( ), 1 deletion(-) | ||
hal:/ | hal:/ | ||
- | Counting objects: 3, done. Writing objects: 100% (3/3), 228 bytes | 0 bytes/s, done. | + | Counting objects: 3, done. |
- | Total 3 (delta 0), reused 0 (delta 0) To / | + | Writing objects: 100% (3/3), 228 bytes | 0 bytes/s, done. |
- | 2016-11-09 12:38 (HEAD -> master) dd4b48d roge v1.1 2016-11-09 09:10 95defef roge v1 | + | Total 3 (delta 0), reused 0 (delta 0) To / |
+ | 95defef..dd4b48d master -> master | ||
+ | hal:/ | ||
+ | 2016-11-09 12:38 (HEAD -> master) dd4b48d roge v1.1 | ||
+ | 2016-11-09 09:10 95defef roge v1 | ||
# | # | ||
# 3ième modification du fichier | # 3ième modification du fichier | ||
Ligne 256: | Ligne 289: | ||
hal:/ | hal:/ | ||
hal:/ | hal:/ | ||
- | [master f9239f9] V1.2 1 file changed, 1 insertion( ), 1 deletion(-) | + | [master f9239f9] V1.2 1 |
+ | file changed, 1 insertion( ), 1 deletion(-) | ||
hal:/ | hal:/ | ||
Counting objects: 3, done. | Counting objects: 3, done. | ||
Ligne 273: | Ligne 307: | ||
hal:/ | hal:/ | ||
hal:/ | hal:/ | ||
- | [new-feature f37b89e] start new feature 1 file changed, 1 insertion( ), 1 deletion(-) | + | [new-feature f37b89e] |
+ | start new feature 1 file changed, 1 insertion( ), 1 deletion(-) | ||
hal:/ | hal:/ | ||
hal:/ | hal:/ | ||
Ligne 279: | Ligne 314: | ||
[new-feature 06f6e84] End new feature 1 file changed, 1 insertion( ), 1 deletion(-) | [new-feature 06f6e84] End new feature 1 file changed, 1 insertion( ), 1 deletion(-) | ||
hal:/ | hal:/ | ||
- | 2016-11-09 13:15 (HEAD -> new-feature) 06f6e84 roge End new feature 2016-11-09 13:14 f37b89e roge start new feature 2016-11-09 13:02 (master) 58f89b5 roge V1.2.2 2016-11-09 13:02 71f0700 roge V1.2.1 2016-11-09 12:56 (test-feature) f9239f9 roge V1.2 2016-11-09 12:38 dd4b48d roge v1.1 2016-11-09 09:10 95defef roge v1 | + | 2016-11-09 13:15 (HEAD -> new-feature) 06f6e84 roge End new feature |
+ | 2016-11-09 13:14 f37b89e roge start new feature | ||
+ | 2016-11-09 13:02 (master) 58f89b5 roge V1.2.2 | ||
+ | 2016-11-09 13:02 71f0700 roge V1.2.1 | ||
+ | 2016-11-09 12:56 (test-feature) f9239f9 roge V1.2 | ||
+ | 2016-11-09 12:38 dd4b48d roge v1.1 | ||
+ | 2016-11-09 09:10 95defef roge v1 | ||
# | # | ||
# Merge: test-feature --> master | # Merge: test-feature --> master | ||
Ligne 290: | Ligne 331: | ||
Deleted branch new-feature (was 06f6e84). | Deleted branch new-feature (was 06f6e84). | ||
hal:/ | hal:/ | ||
- | 2016-11-09 13:15 (HEAD -> master) | + | 2016-11-09 13:15 (HEAD -> master) 06f6e84 roge End new feature |
- | 06f6e84 roge End new feature 2016-11-09 13:14 f37b89e roge start new feature 2016-11-09 13:02 58f89b5 roge V1.2.2 2016-11-09 13:02 71f0700 roge V1.2.1 2016-11-09 12:56 (test-feature) f9239f9 roge V1.2 2016-11-09 12:38 dd4b48d roge v1.1 2016-11-09 09:10 95defef roge v1 | + | 2016-11-09 13:14 f37b89e roge start new feature |
+ | 2016-11-09 13:02 58f89b5 roge V1.2.2 | ||
+ | 2016-11-09 13:02 71f0700 roge V1.2.1 | ||
+ | 2016-11-09 12:56 (test-feature) f9239f9 roge V1.2 | ||
+ | 2016-11-09 12:38 dd4b48d roge v1.1 | ||
+ | 2016-11-09 09:10 95defef roge v1 | ||
# | # | ||
# Mise à jour du repository de reference | # Mise à jour du repository de reference | ||
# | # | ||
- | hal:/ | + | hal:/ |
+ | Counting objects: 12, done. | ||
+ | Delta compression using up to 8 threads. | ||
+ | Compressing objects: 100% (4/4), done. | ||
+ | Writing objects: 100% (12/12), 852 bytes | 0 bytes/s, done. | ||
+ | Total 12 (delta 0), reused 0 (delta 0) To / | ||
+ | f9239f9..06f6e84 master -> master | ||
+ | # Vérification | ||
+ | 2016-11-09 13:15 (HEAD -> master) 06f6e84 roge End new feature | ||
+ | 2016-11-09 13:14 f37b89e roge start new feature | ||
+ | 2016-11-09 13:02 58f89b5 roge V1.2.2 | ||
+ | 2016-11-09 13:02 71f0700 roge V1.2.1 | ||
+ | 2016-11-09 12:56 f9239f9 roge V1.2 | ||
+ | 2016-11-09 12:38 dd4b48d roge v1.1 | ||
+ | 2016-11-09 09:10 95defef roge v1 | ||
</ | </ | ||