This document provides an overview of version control and Git. It discusses what version control is, why it is used, and common types including local, centralized, and distributed. It then focuses on Git, covering its history and origins from Linux kernel development. Key Git concepts are explained like data storage, file lifecycles, basic commands like clone, add, commit, branch, merge, and working with remotes. Tips are provided on installation, ignoring files, using with IDEs, and further learning resources.
This document provides an overview of version control and Git. It discusses what version control is, why it is used, and common types including local, centralized, and distributed. It then focuses on Git, covering its history and origins from Linux kernel development. Key Git concepts are explained like data storage, file lifecycles, basic commands like clone, add, commit, branch, merge, and working with remotes. Tips are provided on installation, ignoring files, using with IDEs, and further learning resources.
This document introduces Git Flow, a Git branching model that provides high-level repository operations. It outlines the main branches - master for production, develop for development, and supporting branches like feature, release, and hotfix. Git Flow is a collection of Git extensions that help initialize and manage branches through commands like git flow feature and git flow release. The model forms an easy to understand mental model for teams to share in their branching and releasing processes.
Cette formation présente les élements de base pour maîtriser git/gitLab. Elle contient aussi des astuces et de bonnes pratiques pour mieux utiliser git.
Git is a version control system that stores snapshots of files rather than tracking changes between file versions. It allows for offline work and nearly all operations are performed locally. Files can exist in three states - committed, modified, or staged. Commits create snapshots of the staged files. Branches act as pointers to commits, with the default branch being master.
This document provides an overview of Git and its basic commands for beginners. It covers installing Git, creating repositories on Bitbucket and GitHub, tracking changes with commands like add, commit, push, pull, and resolving merge conflicts. It also discusses branching, tagging, reverting changes, and ignoring files. Key concepts explained include distributed version control, staging changes, commit histories, and setting up aliases and submodules.
This document provides instructions for setting up Gitlab and generating SSH keys. It demonstrates how to generate an SSH key pair, add the public key to Gitlab, clone a Gitlab project, commit changes and push commits to the remote repository. It also covers initializing Git flow and performing common Git and Gitlab tasks like creating branches, starting a release, and fetching from the remote.
Two days git training with labs
First day covers git basis and essential commands
Second day covers git additional command with a big lab using a git workflow
Git is a version control system that allows developers to have multiple versions of codebases and easily revert changes. Github is a website that hosts git repositories on remote servers, facilitating code sharing among teams through a graphical user interface. The document provides instructions on configuring git and connecting it to Github repositories, as well as describing basic workflows for branching, merging, rebasing, and resolving conflicts when integrating changes.
Git is a distributed version control system that allows developers to work collaboratively on projects. It works by creating snapshots of files in a project over time. Developers can commit changes locally and then push them to a remote repository to share with others. Key Git concepts include repositories, commits, branches, cloning repositories from remote locations, and commands like push, pull, commit, log and diff to manage changes.
The document provides an overview of version control systems and introduces Git and GitHub. It discusses the differences between centralized and distributed version control. It then covers the basics of using Git locally including initialization, staging files, committing changes, branching and merging. Finally, it demonstrates some common remote operations with GitHub such as pushing, pulling and tagging releases.
Git provides a distributed version control system that is faster and more lightweight than the centralized SVN. Git allows for easy branching and merging of code. Developers can work independently on their local repositories and sync changes to remote repositories. This allows teams to work together seamlessly on codebases.
Introduction to Git & GitHub.
Agenda:
- What’s a Version Control System?
- What the heck is Git?
- Some Git commands
- What’s about GitHub?
- Git in Action!
Git is a distributed version control system that records changes to files over time. It allows multiple developers to work together and tracks the version history. The document outlines the basic concepts and commands of Git including repositories, commits, branches, merging, cloning, pulling and pushing changes between a local and remote repository. Examples are provided to demonstrate how to initialize a local repository, add and commit changes, switch branches, and push updates to a remote server.
Git-flow is a Git workflow that advocates using separate branches for features, releases, and hotfixes. It uses a master branch for production-ready code and a develop branch as the main branch where features are integrated. Feature branches are created from develop and merged back after completion. Release branches are created from develop for final testing before merging to both master and develop. Hotfix branches are directly created from master to quickly patch production releases. Pull requests are recommended to communicate changes between branches.
This document provides an introduction to Git and GitHub. It outlines the basics of Git including initializing repositories, tracking changes, branching, merging, and resolving conflicts. It also covers GitHub concepts such as cloning repositories from GitHub to a local machine and pushing/pulling changes between local and remote repositories. The document explains how to collaborate on projects hosted on GitHub using Git.
This document outlines the Gitlab flow for solo development projects, which uses branches for new features, hotfixes, and production deployment. The process involves creating feature branches off of master, merging them back after development, then deploying master to production. Hotfix branches are made from production for bug fixes, then merged to both master and production. Tags are created at deployment points to easily rollback if needed. Branches are deleted once no longer needed to keep the repository clean.
This document provides an overview of version control and the distributed version control system Git. It discusses the history and benefits of version control, including backup and recovery, synchronization, undo capabilities, and tracking changes. Key aspects of Git are explained, such as branching and merging, the fast and efficient nature of Git, and how it allows for cheap local experimentation through branches. The document demonstrates Git workflows and commands and provides resources for further information.
This document introduces Git Flow, a Git branching model that provides high-level repository operations. It outlines the main branches - master for production, develop for development, and supporting branches like feature, release, and hotfix. Git Flow is a collection of Git extensions that help initialize and manage branches through commands like git flow feature and git flow release. The model forms an easy to understand mental model for teams to share in their branching and releasing processes.
Cette formation présente les élements de base pour maîtriser git/gitLab. Elle contient aussi des astuces et de bonnes pratiques pour mieux utiliser git.
Git is a version control system that stores snapshots of files rather than tracking changes between file versions. It allows for offline work and nearly all operations are performed locally. Files can exist in three states - committed, modified, or staged. Commits create snapshots of the staged files. Branches act as pointers to commits, with the default branch being master.
This document provides an overview of Git and its basic commands for beginners. It covers installing Git, creating repositories on Bitbucket and GitHub, tracking changes with commands like add, commit, push, pull, and resolving merge conflicts. It also discusses branching, tagging, reverting changes, and ignoring files. Key concepts explained include distributed version control, staging changes, commit histories, and setting up aliases and submodules.
This document provides instructions for setting up Gitlab and generating SSH keys. It demonstrates how to generate an SSH key pair, add the public key to Gitlab, clone a Gitlab project, commit changes and push commits to the remote repository. It also covers initializing Git flow and performing common Git and Gitlab tasks like creating branches, starting a release, and fetching from the remote.
Two days git training with labs
First day covers git basis and essential commands
Second day covers git additional command with a big lab using a git workflow
Git is a version control system that allows developers to have multiple versions of codebases and easily revert changes. Github is a website that hosts git repositories on remote servers, facilitating code sharing among teams through a graphical user interface. The document provides instructions on configuring git and connecting it to Github repositories, as well as describing basic workflows for branching, merging, rebasing, and resolving conflicts when integrating changes.
Git is a distributed version control system that allows developers to work collaboratively on projects. It works by creating snapshots of files in a project over time. Developers can commit changes locally and then push them to a remote repository to share with others. Key Git concepts include repositories, commits, branches, cloning repositories from remote locations, and commands like push, pull, commit, log and diff to manage changes.
The document provides an overview of version control systems and introduces Git and GitHub. It discusses the differences between centralized and distributed version control. It then covers the basics of using Git locally including initialization, staging files, committing changes, branching and merging. Finally, it demonstrates some common remote operations with GitHub such as pushing, pulling and tagging releases.
Git provides a distributed version control system that is faster and more lightweight than the centralized SVN. Git allows for easy branching and merging of code. Developers can work independently on their local repositories and sync changes to remote repositories. This allows teams to work together seamlessly on codebases.
Introduction to Git & GitHub.
Agenda:
- What’s a Version Control System?
- What the heck is Git?
- Some Git commands
- What’s about GitHub?
- Git in Action!
Git is a distributed version control system that records changes to files over time. It allows multiple developers to work together and tracks the version history. The document outlines the basic concepts and commands of Git including repositories, commits, branches, merging, cloning, pulling and pushing changes between a local and remote repository. Examples are provided to demonstrate how to initialize a local repository, add and commit changes, switch branches, and push updates to a remote server.
Git-flow is a Git workflow that advocates using separate branches for features, releases, and hotfixes. It uses a master branch for production-ready code and a develop branch as the main branch where features are integrated. Feature branches are created from develop and merged back after completion. Release branches are created from develop for final testing before merging to both master and develop. Hotfix branches are directly created from master to quickly patch production releases. Pull requests are recommended to communicate changes between branches.
This document provides an introduction to Git and GitHub. It outlines the basics of Git including initializing repositories, tracking changes, branching, merging, and resolving conflicts. It also covers GitHub concepts such as cloning repositories from GitHub to a local machine and pushing/pulling changes between local and remote repositories. The document explains how to collaborate on projects hosted on GitHub using Git.
This document outlines the Gitlab flow for solo development projects, which uses branches for new features, hotfixes, and production deployment. The process involves creating feature branches off of master, merging them back after development, then deploying master to production. Hotfix branches are made from production for bug fixes, then merged to both master and production. Tags are created at deployment points to easily rollback if needed. Branches are deleted once no longer needed to keep the repository clean.
This document provides an overview of version control and the distributed version control system Git. It discusses the history and benefits of version control, including backup and recovery, synchronization, undo capabilities, and tracking changes. Key aspects of Git are explained, such as branching and merging, the fast and efficient nature of Git, and how it allows for cheap local experimentation through branches. The document demonstrates Git workflows and commands and provides resources for further information.
Git est un logiciel de gestion de versions décentralisé qui vous permettra de gérer la vie d'un code informatique. Il permet une stratégie de backup, de gérer des versions et de stocker tout l'historique des modifications apportées à un projet informatique.
Cette présentation montre plusieurs outils gratuits qui peuvent être utilisés pour gérer plusieurs aspects de la gestion de projets, en particulier informatique, de manière collaborative. On y voit comment versioner son code avec Git, déployer son code avec Heroku, tester son code avec Travis, gérer et planifier son temps et ses tâches avec Trello, FreedCamp et Tom'splanner, comment communiquer avec Slack et comment rédiger sa documentation avec Read the Docs.
Ce premier cours introduit à plusieurs aspects liés au développement informatique. Le cours présente comment versioner son code avec le système Git et comment le déployer avec Heroku. Il présente ensuite comment débugguer avec le module pdb et comment profiler son code avec les modules timeit et profile. Enfin, le cours termine en présentant le concept de tests unitaires que l'on peut construire avec les modules doctest et unittest.
SOLID : les principes à l’origine du succès de Symfony et de vos applicationsVladyslav Riabchenko
SOLID est un acronyme représentant cinq principes de bases de la programmation orientée objet permettant le développement de logiciels fiables, évolutifs et robustes. Le framework Symfony est un excellent support pour illustrer chacun de ces principes. Nous verrons ainsi que SOLID est à l’origine de sa flexibilité, sa fiabilité mais aussi de sa maintenabilité et son évolutivité. Nous verrons également comment appliquer ces principes pour améliorer son code métier et perfectionner l’architecture de son application.
Sécurisation de vos applications web à l’aide du composant Security de SymfonyVladyslav Riabchenko
L'authentification et l’autorisation sont omniprésents dans les applications web. Cependant la sécurisation des applications Symfony semble assez compliquée surtout pour les débutants. Je vous propose d'examiner le composant Security de Symfony pour comprendre comment la couche d'authentification est organisée et comment les règles d'autorisation sont implémentées. Nous verrons les classes qui se cachent derrière la configuration dans votre security.yml.
Sécurisation de vos applications web à l’aide du composant Security de SymfonyVladyslav Riabchenko
Présentation pour meetup d'AFUP : https://www.meetup.com/fr-FR/afup-paris-php/events/253944518/
Le code : https://github.com/vria/symfony-security-component-use
Intervention sur le versionning sémantique et contraintes de versions dans composer.json pour la soirée de veille technologique à Webnet le 28/11/2017.
This document summarizes an presentation about dependency injection in Symfony 3.3 or greater. It discusses the service container and how it is used to instantiate services and inject their dependencies. It covers how to configure services and their dependencies, including using autowiring to simplify configuration. It also discusses autoconfiguring services as forms or commands. Finally, it presents options like _defaults and grouped declarations that can reduce configuration size.
3. Un gestionnaire de version est un système qui enregistre l’évolution d’un fichier ou
d’un ensemble de fichiers au cours du temps de manière à ce qu’on puisse rappeler une
version antérieure d’un fichier à tout moment.
Il vous permet de :
ramener un fichier à un état précédent
ramener le projet complet à un état précédent
visualiser les changements au cours du temps
voir qui a modifié quelque chose qui pourrait causer un problème, qui a introduit un
problème et quand, et plus encore
facilement revenir à un état stable si vous vous trompez ou si vous perdez des fichiers
travailler en équipe sur un ou plusieurs fichiers en même temps en gérant les conflits
lorsqu'une même portion de contenu est modifié par plusieurs personnes
3
4. Technique consistant à recopier les fichiers dans un autre répertoire (par exemple
avec un nom incluant la date dans le meilleur des cas).
4
5. Serveur central qui
contient tous les
fichiers sous
gestion de version,
et des clients qui
peuvent extraire les
fichiers de ce dépôt
central.
Les systèmes de gestion de version centralisés.
5
9. Les trois espaces
Dépôt local – les données sont
stockées en sécurité dans votre
base de données locale
Espace de travail – Les fichiers
dans votre répertoire
Index – un espace spécial pour
préparer l’instantané suivant
(next commit)
9
11. L’utilisation habituelle de Git se
déroule comme suit :
1. Modification des fichiers dans
votre répertoire de travail ;
2. Indexation (add) des fichiers
modifiés (ajout de leurs instantanés
dans la zone d’index) ;
3. Commit (commit), ce qui a pour
effet de basculer les instantanés des
fichiers de l’index dans la base de
données Git.
4. Versement (push) de votre
travail sur le(s) serveur(s) distant(s)
Les quatre états
11
12. parcourir l’historique d’un projet
rétablir n’importe quel état de fichier ou de projet en entier
valider (commit) votre travail.
créer une branche, fusionner des branches
Votre dépôt local vous permet de :
Presque toutes les opérations sont locales
12
13. Git gère l’intégrité
Tout est vérifié par une somme de contrôle :
avant d’être stocké / après avoir été récupéré en local
la somme sert de référence
Git utilise une empreinte SHA-1: une chaîne de caractères composée de 40 caractères
hexadécimaux. SHA-1 calculée en fonction du contenu du fichier ou de la structure du
répertoire considéré.
24b9da6552252987aa493b52f8696cd6d3b00373
13
14. Git gère l’intégrité
modifier le contenu d’un fichier ou d’un répertoire sans que Git ne s’en aperçoive
perdre des données en cours de transfert
24b9da6552252987aa493b52f8696cd6d3b00373
corrompre un fichier sans que Git ne puisse le détecter
Il est impossible de :
14
16. Démarrer un dépôt Git
git init
• initialise le nouveau dépôt dans un répertoire existant
• crée un sous répertoire .git
• crée une nouvelle branche master
git clone [url] ([directory])
• copie un dépôt déjà hébergé sur le serveur
• reçoit une copie de quasiment toutes les données dont le serveur dispose
• installe une branche par défaut dans le répertoire de travail
• ajoute un dépôt distant par défaut sous le nom origin
16
17. Préparer un commit
git add Met à jour l'index en utilisant le contenu spécifié pour préparer le prochain commit.
Espace de travail Index
add
• pathspec: single_file | *.txt | directory
• -A, --all
17
18. Supprimer des fichiers
rm --cached
git rm
Espace de travail Index
• pathspec: single_file | *.txt | directory
• --cached
• -r
rm
18
19. Rétablir une version antérieure de fichiers
checkout [pathspec]
git checkout
Espace de travail Index
• pathspec: single_file | *.txt | directory
19
20. Commiter
git commit Stocke le contenu actuel de l'index dans un nouveau commit
avec un message de journal de l'utilisateur décrivant les modifications.
Espace de travail Index
add
Local repository
commit
• -a
• --amend
20
21. Voir l’état de fichers
git status
• -s
• peut se lancer dans un sous-répertoire
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: modified-in-index-and-wd.php
deleted: file-to-remove.txt
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: modified-in-working-directory.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
nf.txt
M A
D second.txt
M test.txt
?? nf.txt
21
22. Voir l’historique
git log
• -1, -2, … nombre de commits à afficher
• -p diff de chaque commit
• --stat aperçu rapide de commit
• --pretty
• --graph graphique ASCII de l'historique des branches et des fusions
22
23. Déplacer des fichiers
git mv <source> <destination>
git mv <source> ... <destination directory>
Cette commande permet de conserver l’historique des changements d’un fichier
quand vous le renommez ou déplacez.
23
24. Ignorer les fichiers
Pour que Git ne suit plus certain fichiers il les lister dans le fichier .gitignore. Chaque
ligne d'un fichier gitignore spécifie un patron:
# commentaire
!<patron> – nier le patron
nom – fichier ou répertoire dans n’importe quel sous répertoire
répertoire/ – répertoire dans n’importe quel sous répertoire
/nom – fichier ou répertoire dans la racine
/répertoire/ – répertoire dans la racine
a/**/b – correspond à « a/b » ou « a/x/b » ou « a/x/y/b »
24
25. Travaille pratique
1. Démarrer un dépôt local
2. Créer deux fichiers, ajouter le premier dans index
3. Valider
4. Modifiez le premier, abandonnez ces modifications. Modifiez-le encore une fois, ajoutez-le
dans l’index et abandonnez ces modifications
5. Modifier le premier et valider tous les fichiers dans un nouveau commit
6. Rétablir le premier fichier d’un premier commit
7. Changez le nom de deuxième fichier, validez. Assurez-vous que l’historique de
changements est sauvegardé
8. Ajoutez le deuxième fichier dans l’ignore, supprimez-le d’une validation suivante
25
28. Branches. En bref
commit Git stocke un objet commit qui contient un pointeur vers l’instantané (snapshot)
du contenu que vous avez indexé
• nom et prénom de l’auteur
• le message
• des pointeurs vers le ou les commits parent
• pointeur vers l’empreinte de l'arborescence de projet (tree snapshot)
28
29. Branches. En bref
git add README test.rb LICENSE
git commit -m 'initial commit of my project'
29
42. Branches. Conflits de fusions
git merge prob53
Auto-merging index.html
CONFLICT (content): Merge conflict in index.html
Automatic merge failed; fix conflicts and then commit the result.
git status
On branch master
You have unmerged paths.
(fix conflicts and run "git commit")
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: index.html
no changes added to commit (use "git add" and/or "git commit -a")
42
43. Branches. Conflits de fusions
<<<<<<< HEAD:index.html
<div id="footer">contact : email.support@github.com</div>
=======
<div id="footer">
please contact us at support@github.com
</div>
>>>>>>> prob53:index.html
<div id="footer">
please contact us at email.support@github.com
</div>
$ git add –A
$ git commit
Afin de terminer le merge il faudra créer un commit
43
44. Travaille pratique
1. Vous devez déjà avoir un dépôt avec deux fichiers dans la branche master
2. Créez et extrayez la branche secondaire (ticket123 par exemple)
3. Changez et ajoutez des fichiers, validez vos modifications
4. Fusionnez vos modifications à la branche master (fast-forward)
5. Supprimez cette branche secondaire
6. Répétez les p. 2 – 3
7. Extrayez la branche master
8. Modifier autrement le même endroit dans un même fichier que vous venez de modifier
dans une branche secondaire pour provoquer un conflit
9. Fusionnez les modifications à la branche master, résolvez le conflit, validez un nouveau
fusion
10. Utilisez souvent les commandes log et status
44
46. Stash
$ git stash save “my personal stash comment“
Saved working directory and index state On master: my personal stash comment
$ git stash list
stash@{0}: On master: my personal stash comment
$ git stash
Saved working directory and index state WIP on issue: 410b55d commit message
$ git stash list
stash@{0}: WIP on issue: 410b55d commit message
Il est possible de changer la branche seulement si vous n’avez aucun fichier modifié ou ajouté
et votre zone d’index ne contient aucun modification.
Pour changer un branche et sauvegarder le travail pour y revenir plus tard il est possible
d’utiliser le remisage.
stash [save [<message>]]
46
47. Stash
Pour vérifier le statut de la zone de remisage et le gérer utilisez ces commandes
stash list
stash show [<stash>]
stash drop [<stash>]
stash clear
47
48. Stash
Pour réintégrer le travail sauvegardé dans le remisage utilisez l’un de ces commandes :
stash apply [<stash>] – appliquer les modifications à votre espace de travail
stash pop [<stash>] – appliquer les modifications et supprimer le stash
stash branch <branchname> [<stash>] – créer une branche et et supprimer
le stash
48
49. Travaille pratique
1. Passez votre travaille dans la zone de remisage afin de pouvoir changer la branche
2. Essayez plusieurs commandes pour appliquer le travail de stash (apply, stash, branch)
49
51. Tags
git tag -l
v0.1
v1.0
v1.3
tous
git tag –l ‘v1’
V1.0
v1.3
filtrés
git tag 1.4.3 [<commit>]
Légère
git tag -a v1.4 -m ‘mep 1.4’ [<commit>]
Annoté
git show v1.4
tag v1.4
Tagger: Ben Straub <ben@straub.cc>
Date: Sat May 3 20:19:12 2014 -0700
ma version 1.4
commit ca82a6dff817ec66f44342007202690a93763949
Author: Scott Chacon <schacon@gee-mail.com>
Date: Mon Mar 17 21:52:11 2008 -0700
changed the version number
git show v1.4.3
commit ca82a6dff817ec66f44342007202690a93763949
Author: Scott Chacon <schacon@gee-mail.com>
Date: Mon Mar 17 21:52:11 2008 -0700
changed the version number
Lister
Créer
51
53. Eléments distants
branches
tags
• Les dépôts locaux sont accessibles par <remote>/<branch>
• Sont modifiables automatiquement lors de communication avec un dépôt distant
dépôts (origin)
53
55. Eléments distants
clone Télécharge le dépôt dans le nouveau répertoire
• crée toutes les branches distantes
• crée les branches locales et en fait des branches de suivi
• --depth <n> limite l’historique téléchargée
master origin/master masterfetch
lot1 origin/lot1 lot1fetch
poste locale gitlab.webnet.fr
merge
merge
55
58. Eléments distants
pull (git fetch & git merge FETCH_HEAD) tirer des objets distants
X---Y---Z master sur gitlab.webnet.fr
/
A---B---C---D master dans votre espace de travail
^
origin/master dans votre dépôt local
X---Y---Z master sur gitlab.webnet.fr
/
A---B---C---D---E master dans votre espace de travail
/
X---Y---Z
^
origin/master dans votre dépôt local
git pull
58
59. Eléments distants
pull (git fetch & git merge FETCH_HEAD)
X---Y---Z master sur gitlab.webnet.fr
/
A---B master dans votre espace de travail
^
origin/master dans votre dépôt local
X---Y---Z master sur gitlab.webnet.fr
/
A---B---X---Y---Z master dans votre espace de travail
^
origin/master dans votre dépôt local
git pull (fast forward)
59
60. Eléments distants
push [ <repository> [ <branch> ] ]
X---Y---Z master sur gitlab.webnet.fr
/
A---B---C---D---E master dans votre espace de travail
/
X---Y---Z
^
origin/master dans votre dépôt local
X---Y---Z---E master sur gitlab.webnet.fr
/ /
A---B---C---D---E master dans votre espace de travail
^
origin/master dans votre dépôt local
git push
60
62. Branches distants
$ git remote show origin
* remote origin
Fetch URL: git@gitlab.webnet.fr:webnet/verifimmo-backimmo2.git
Push URL: git@gitlab.webnet.fr:webnet/verifimmo-backimmo2.git
HEAD branch: master
Remote branches:
lot1 tracked
lot2 tracked
master tracked
refs/remotes/origin/test-jenkins stale (use 'git remote prune' to remove)
Local branches configured for 'git pull':
lot1 merges with remote lot1
lot2 merges with remote lot2
master merges with remote master
Local refs configured for 'git push':
lot1 pushes to lot1 (local out of date)
lot2 pushes to lot2 (local out of date)
master pushes to master (local out of date)
git remote show <name>
62
63. Eléments distants - Exemple
Un nouveau dépôt sur le serveur github.com (avec README.md) avec la branche master
Il existe un dépôt local contenant l’application Symfony avec la branche master
Le but est de relier ces deux projets: pouvoir retirer / pousser, configurer la branche de suivi
$ git remote add origin git@github.com:vria/git-workshop.git
$ git fetch origin
warning: no common commits
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:vria/git-workshop
* [new branch] master -> origin/master
master origin/master masterfetch
Poste local gitlab.webnet.fr
64. $ git merge master origin/master
fatal: refusing to merge unrelated histories
Eléments distants - Exemple
$ git merge master origin/master --allow-unrelated-histories
Merge made by the 'recursive' strategy.
README.md | 1 +
1 file changed, 1 insertion(+)
create mode 100644 README.md
Puisque votre branche locale master n’a pas d’historique commun avec origin/master il faut
demander explicitement à fusionner deux branches sans aucune relation.
Les nouveaux commits de origin/master peuvent être mergés sans souci à master.
64
65. Eléments distants - Exemple
master origin/master masterfetch
Poste local gitlab.webnet.fr
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
$ git push
fatal: La branche courante master n'a pas de branche amont.
Pour pousser la branche courante et définir la distante comme amont, utilisez
git push --set-upstream origin master
65
68. Travaille pratique. Dépôt commun
1. Clonez le dépôt
2. Créez et/ou modifiez le fichier, validez
3. Poussez vos modifications sur le serveur (possiblement, après avoir récupérer le travail
d’un autre collaborateur)
4. Créez votre branche (son nom sera votre prénom), modifiez-y les fichiers, poussez-la sur
le serveur
5. Récupérez la branche de votre collègue, fusionnez-la avec master
6. Supprimez la branche de votre collègue et poussez master sur le serveur
68
69. Travaille pratique. Dépôt tiers
1. Faites un « fork » d’un projet public
2. Clonez votre nouveau dépôt
3. Modifiez et/ou créez des fichiers
4. Validez et poussez
5. Créez un « pull request » (« merge request »)
6. …
7. PROFIT
69