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:45] – [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 182: | Ligne 197: | ||
| # Configuration de Git | # Configuration de Git | ||
| # | # | ||
| - | hal:/ | + | hal:/ |
| + | [core] | ||
| + | repositoryformatversion = 0 filemode = true bare = false | ||
| + | logallrefupdates = true | ||
| + | [branch " | ||
| + | remote = / | ||
| + | merge = refs/ | ||
| + | [remote " | ||
| + | url = / | ||
| + | fetch = refs/heads | ||
| + | / | ||
| + | push = master fetch = master | ||
| # | # | ||
| # Création du dossier de travail avec initialisation Git | # Création du dossier de travail avec initialisation Git | ||
| # | # | ||
| - | hal:/data $ git init Test-Git Initialized empty Git repository in / | + | hal:/data $ git init Test-Git |
| + | Initialized empty Git repository in / | ||
| # | # | ||
| # 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 / |
| + | hal:/ | ||
| + | Initialized empty Git repository in / | ||
| + | hal:/ | ||
| + | $ cd Test-Git/ | ||
| + | hal:/ | ||
| + | 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 | ||
| # | # | ||
| # Status | # Status | ||
| - | # | + | # |
| - | # | + | hal:/ |
| + | On branch master Initial commit | ||
| + | Untracked files: (use "git add < file> | ||
| + | test.txt nothing added to commit but untracked files present (use "git add" to track) | ||
| + | # | ||
| + | Ajout dans Git | ||
| + | # | ||
| + | hal:/ | ||
| + | hal:/ | ||
| + | On branch master Initial commit Changes to be committed: | ||
| + | (use "git rm --cached < file> | ||
| + | # | ||
| + | # Commit | ||
| + | # | ||
| + | hal:/ | ||
| + | [master (root-commit) 95defef] v1 1 file changed, 1 insertion( ) create mode 100644 test.txt | ||
| + | # 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:/ |
| - | 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 / | ||
| + | * [new branch] master -> master | ||
| + | # Vérification | ||
| + | hal:/ | ||
| + | hal:/ | ||
| + | $ git log | ||
| + | 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:/ |
| + | hal:/ | ||
| + | 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:/ | ||
| + | [master dd4b48d] v1.1 1 | ||
| + | file changed, 1 insertion( ), 1 deletion(-) | ||
| + | hal:/ | ||
| + | Counting objects: 3, done. | ||
| + | Writing objects: 100% (3/3), 228 bytes | 0 bytes/s, done. | ||
| + | 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 | ||
| # | # | ||
| - | hal:/ | + | hal:/ |
| + | hal:/ | ||
| + | hal:/ | ||
| + | [master f9239f9] V1.2 1 | ||
| + | file changed, 1 insertion( ), 1 deletion(-) | ||
| + | hal:/ | ||
| + | Counting objects: 3, done. | ||
| + | Writing objects: 100% (3/3), 230 bytes | 0 bytes/s, done. | ||
| + | Total 3 (delta 0), reused 0 (delta 0) To / | ||
| + | master -> master Branch master set up to track remote branch master from / | ||
| # | # | ||
| # Création d'une branche | # Création d'une branche | ||
| Ligne 215: | Ligne 304: | ||
| # Création de changements | # Création de changements | ||
| # | # | ||
| - | hal:/ | + | hal:/ |
| - | hal:/ | + | hal:/ |
| - | hal:/ | + | hal:/ |
| + | [new-feature f37b89e] | ||
| + | start new feature 1 file changed, 1 insertion( ), 1 deletion(-) | ||
| + | hal:/ | ||
| + | hal:/ | ||
| + | hal:/ | ||
| + | [new-feature 06f6e84] End new feature 1 file changed, 1 insertion( ), 1 deletion(-) | ||
| + | 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 | ||
| # | # | ||
| # Merge: test-feature --> master | # Merge: test-feature --> master | ||
| # | # | ||
| hal:/ | hal:/ | ||
| - | hal:/ | + | hal:/ |
| - | hal:/ | + | Updating 58f89b5..06f6e84 Fast-forward test.txt | 2 - 1 file changed, 1 insertion( ), 1 deletion(-) |
| + | # Suppression de la branche | ||
| + | hal:/ | ||
| + | Deleted branch new-feature (was 06f6e84). | ||
| + | hal:/ | ||
| + | 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 (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 | ||
| </ | </ | ||