issue86:command_conquer
Différences
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 | ||
issue86:command_conquer [2014/12/23 15:38] – d52fr | issue86:command_conquer [2014/12/27 10:17] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
**Last month we covered a series of examples when it came to using Git in combination with Github. Within this article, I asked if there was any interest in an article on hosting/ | **Last month we covered a series of examples when it came to using Git in combination with Github. Within this article, I asked if there was any interest in an article on hosting/ | ||
- | Le mois dernier, nous avons passé en revue une série d' | + | Le mois dernier, nous avons passé en revue une série d' |
**Git Server | **Git Server | ||
Ligne 9: | Ligne 9: | ||
Serveur Git | Serveur Git | ||
- | La façon la plus facile de configurer un serveur | + | La façon la plus facile de configurer un serveur |
**Creating a new repository | **Creating a new repository | ||
Ligne 18: | Ligne 18: | ||
Créer un nouveau dépôt | Créer un nouveau dépôt | ||
- | Partant de l' | + | Partant de l' |
git --bare init < | git --bare init < | ||
- | Si le répertoire n' | + | Si le répertoire n' |
- | indique à git d' | + | |
**Adding files to the repository | **Adding files to the repository | ||
Ligne 37: | Ligne 36: | ||
Ajouter des fichiers dans un dépôt | Ajouter des fichiers dans un dépôt | ||
- | Sans se soucier de savoir si vous avez initialisé un répertoire vide ou utilisé un répertoire déjà rempli, rien n'est ajouté au répertoire choisi par défaut.Vous aurez besoin de lancer : | + | Sans se soucier de savoir si vous avez initialisé |
- | git add | + | git add |
- | Avant rien n'était ajouté. Un fois que vous l'avez ajouté, vous devrez aussi confirmer (commit) les changements par : | + | avant d'y ajouter quoi que ce soit. Une fois que vous l'avez ajouté, vous devrez aussi confirmer (commit) les changements par : |
git commit -m “Message” | git commit -m “Message” | ||
Ligne 52: | Ligne 51: | ||
Now that the repository is created and contains content, it's time to clone it to a new machine.** | Now that the repository is created and contains content, it's time to clone it to a new machine.** | ||
- | Remplacez « message | + | Remplacez « message |
git commit -a -m “Message” | git commit -a -m “Message” | ||
- | Le commutateur < | + | Le commutateur < |
Maintenant que le dépôt est créé et contient du contenu, il est temps de le cloner sur une nouvelle machine. | Maintenant que le dépôt est créé et contient du contenu, il est temps de le cloner sur une nouvelle machine. | ||
Ligne 77: | Ligne 76: | ||
Hypothèses : | Hypothèses : | ||
- | * Vous utilisez le port normal | + | * Vous utilisez le port normal |
- | * Votre identifiant est gituser | + | * Votre identifiant est gituser. |
- | * Le domaine du serveur est git.example.com | + | * Le domaine du serveur est git.example.com. |
- | * Le chemin est / | + | * Le chemin est / |
- | * Le dépôt | + | * Le dépôt lui-même s' |
- | A partir de ces hypothèse, la commande de clonage de git devrait ressembler à ceci : | + | A partir de ces hypothèses, la commande de clonage de git devrait ressembler à ceci : |
< | < | ||
- | Si vous créer | + | Si vous créez |
**The SSH format for git is as follows: | **The SSH format for git is as follows: | ||
- | ssh://< | + | < |
Replace < | Replace < | ||
Ligne 101: | Ligne 100: | ||
However, it doesn' | However, it doesn' | ||
+ | |||
+ | Le format SSH pour git est le suivant : | ||
+ | < | ||
+ | |||
+ | Remplacez < | ||
+ | • Correct : / | ||
+ | • Erronés : ~/ | ||
+ | |||
+ | Si vous utilisez le port standard, vous pouvez réduire un peu le format en écrivant la commande comme ceci : | ||
+ | |||
+ | git clone < | ||
+ | |||
+ | Cependant, ça ne demande pas beaucoup plus d' | ||
**Once you've cloned the repository, you can git add, git commit, and then (in order to synchronize the changes) use git push. The format of this command (like last month) is: | **Once you've cloned the repository, you can git add, git commit, and then (in order to synchronize the changes) use git push. The format of this command (like last month) is: | ||
Ligne 107: | Ligne 119: | ||
Typically, the < | Typically, the < | ||
+ | |||
+ | git push origin master ** | ||
+ | |||
+ | Une fois le dépôt cloné, vous pouvez faire git add, git commit et ensuite (de façon à synchroniser les changements) utilisez git push. Le format de cette commande (comme le mois dernier) est : | ||
+ | |||
+ | git push < | ||
+ | |||
+ | Typiquement, | ||
git push origin master | git push origin master | ||
- | If you run into an error (such as the remote origin not being defined), you'll need to add the target to your repository. To do this, change directory to the repository, and then run: | + | **If you run into an error (such as the remote origin not being defined), you'll need to add the target to your repository. To do this, change directory to the repository, and then run: |
- | git remote add origin ssh:// | + | < |
This will define a remote target called origin in the repository, and use the URL you supplied. This shouldn' | This will define a remote target called origin in the repository, and use the URL you supplied. This shouldn' | ||
+ | |||
+ | Si vous rencontrez une erreur (comme l' | ||
+ | |||
+ | < | ||
+ | |||
+ | Ceci définira une cible distante appelée origin dans le dépôt et utilisera l'URL que vous avez fournie. Ca ne devrait pas être exigé (du moins dans mes tests je n'ai jamais eu besoin de définir l' | ||
**Branches | **Branches | ||
Ligne 130: | Ligne 156: | ||
git branch < | git branch < | ||
git checkout < | git checkout < | ||
+ | |||
+ | Branches | ||
+ | |||
+ | Le lecteur qui m'a contacté souhaitait aussi quelques informations sur la création, la fusion et clonage de branches particulières dans un dépôt. Toute personne qui envisage du développement sérieux avec git voudra apprendre ce que sont les branches, de façon à conserver l' | ||
+ | |||
+ | Créer une nouvelle branche | ||
+ | |||
+ | Assurez-vous que le répertoire courant est celui de votre dépôt puis tapez la commande suivante : | ||
+ | |||
+ | git checkout -b < | ||
+ | |||
+ | Une nouvelle branche sera créée, appelée < | ||
+ | |||
+ | git branch < | ||
+ | git checkout < | ||
**As you can see, the short-hand is a lot less repetition. These two steps are also required only if you're creating branches – changing between branches is as simple as writing: | **As you can see, the short-hand is a lot less repetition. These two steps are also required only if you're creating branches – changing between branches is as simple as writing: | ||
Ligne 140: | Ligne 181: | ||
To push your new branch to the remote host “origin”, | To push your new branch to the remote host “origin”, | ||
+ | |||
+ | Comme vous pouvez le voir, la commande raccourcie évite les répétitions. Ces deux étapes ne sont requises que si vous créez des branches - passer d'une branche à l' | ||
+ | |||
+ | git checkout < | ||
+ | |||
+ | Quand vous aurez changé pour la branche dans laquelle vous voulez travailler, continuez votre travail comme d' | ||
+ | |||
+ | git push origin < | ||
+ | |||
+ | Pour pousser (push) la nouvelle branche vers l' | ||
**Assuming you've completed development in the development branch, and are ready to merge it back into the stable (master) branch, then you would need to do the following: | **Assuming you've completed development in the development branch, and are ready to merge it back into the stable (master) branch, then you would need to do the following: | ||
Ligne 148: | Ligne 199: | ||
git merge < | git merge < | ||
+ | |||
+ | Supposons que vous avez terminé le développement dans la branche development et que vous êtes prêt à la fusionner dans la branche stable (le maître), alors vous utiliseriez la commande suivante : | ||
+ | |||
+ | git checkout master | ||
+ | |||
+ | Cette commande vous ramène dans la branche maître - quand vous fusionnez, il est nécessaire d' | ||
+ | |||
+ | git merge < | ||
**Make sure you enter the actual branch name. This type of merge uses the typical git approach to conflicts – if it can't automatically resolve the conflict, it will instead mark the changes in the file within the repository, and you need to resolve it manually, then re-add and commit the changes. See last month' | **Make sure you enter the actual branch name. This type of merge uses the typical git approach to conflicts – if it can't automatically resolve the conflict, it will instead mark the changes in the file within the repository, and you need to resolve it manually, then re-add and commit the changes. See last month' | ||
+ | |||
+ | Assurez-vous de saisir le nom de branche correct. Ce type de fusion utilise l' | ||
**Deleting a branch | **Deleting a branch | ||
Ligne 161: | Ligne 222: | ||
git push origin :< | git push origin :< | ||
- | git push origin --delete < | + | git push origin --delete < |
- | **The difference is that the top command is supported in versions of git as of 1.5.0, and the second one is supported only as of 1.7.0. | + | The difference is that the top command is supported in versions of git as of 1.5.0, and the second one is supported only as of 1.7.0.** |
- | Renaming a branch | + | Supprimer une branche |
+ | |||
+ | Localement une vieille branche s' | ||
+ | |||
+ | git branch -D < | ||
+ | |||
+ | Cependant, si vous voulez aussi l' | ||
+ | |||
+ | git push origin :< | ||
+ | |||
+ | git push origin --delete < | ||
+ | |||
+ | La différence vient de ce que la commande du haut est supportée dans les versions de git dès la 1.5.0 et que la seconde est supportée uniquement à partir de la 1.7.0. | ||
+ | |||
+ | **Renaming a branch | ||
If you want to rename a branch locally (i.e. from development to dev): | If you want to rename a branch locally (i.e. from development to dev): | ||
Ligne 176: | Ligne 251: | ||
Also, if you want to rename the current branch, you can omit the <old> part of the command, i.e. git branch -m dev.** | Also, if you want to rename the current branch, you can omit the <old> part of the command, i.e. git branch -m dev.** | ||
+ | |||
+ | Renommer une branche | ||
+ | |||
+ | Si vous voulez renommer une branche localement (par exemple de development à dev) : | ||
+ | |||
+ | git branch -m <old> <new> | ||
+ | |||
+ | Ainsi, pour notre exemple : | ||
+ | |||
+ | git branch -m development dev | ||
+ | |||
+ | Si vous voulez renommer la branche courante, vous pouvez omettre <old> dans la commande, par exemple git branch -m dev. | ||
**Renaming a local branch when pushing it to the remote server | **Renaming a local branch when pushing it to the remote server | ||
Ligne 185: | Ligne 272: | ||
git push origin testing: | git push origin testing: | ||
+ | |||
+ | Renommer une branche locale avant de la pousser vers le serveur distant | ||
+ | |||
+ | Disons, par exemple, que vous avez une branche appelée testing sur votre copie du dépôt. Problème : quelqu' | ||
+ | |||
+ | git push origin < | ||
+ | |||
+ | Ce qui donne dans notre exemple : | ||
+ | |||
+ | git push origin testing: | ||
**This will take our local testing repository and upload it to the server, while renaming that branch mobile. This may also help people to understand the deletion command in git 1.5.0: you're essentially pushing a NULL repository (i.e. one that doesn' | **This will take our local testing repository and upload it to the server, while renaming that branch mobile. This may also help people to understand the deletion command in git 1.5.0: you're essentially pushing a NULL repository (i.e. one that doesn' | ||
Ligne 196: | Ligne 293: | ||
git --bare init** | git --bare init** | ||
+ | |||
+ | Notre dépôt testing va être pris et téléversé sur le serveur, avec le nom de branche mobile. Ceci aide peut-être à comprendre la commande de suppression dans git 1.5.0 : en fait, vous poussez un dépôt « null » (c' | ||
+ | |||
+ | Vérifier une branche spécifique | ||
+ | |||
+ | C'est la dernière question du mail que j'ai reçu. J'ai supposé qu'il voulait dire cloner une seule branche et ignorer tout le reste. C'est une tâche un peu plus compliquée que je vais décrire ci-dessous : | ||
+ | |||
+ | mkdir < | ||
+ | |||
+ | cd < | ||
+ | |||
+ | git --bare init | ||
**Alternatively, | **Alternatively, | ||
- | git remote add origin ssh:// | + | < |
This is required in order to link the remote repository with the new local repository you just created, that will end up containing only the branch you want. | This is required in order to link the remote repository with the new local repository you just created, that will end up containing only the branch you want. | ||
git fetch origin < | git fetch origin < | ||
+ | |||
+ | Ou d'une autre façon, lancez simplement git --bare init < | ||
+ | |||
+ | < | ||
+ | |||
+ | Ceci est nécessaire pour relier le dépôt distant au nouveau dépôt local que vous venez de créer, qui ne contiendra que la branche que vous voulez. | ||
+ | |||
+ | git fetch origin < | ||
**There are a few things to note about this command: If your remote target is something other than origin, change both occurrences of origin in the command. Also, replace < | **There are a few things to note about this command: If your remote target is something other than origin, change both occurrences of origin in the command. Also, replace < | ||
Ligne 213: | Ligne 330: | ||
Note: If you don't mind downloading all the existing branches, and simply want git to default to a different branch (i.e. if you plan to merge branches later), you can do it much easier with: | Note: If you don't mind downloading all the existing branches, and simply want git to default to a different branch (i.e. if you plan to merge branches later), you can do it much easier with: | ||
- | git clone ssh:// | + | < |
+ | |||
+ | Il y a quelques points à noter à propos de cette commande : si votre cible distante est différente d' | ||
+ | |||
+ | git checkout -b < | ||
+ | |||
+ | Ceci crée maintenant la branche dans votre dépôt local et ensuite la relie à la branche de la cible distante - en fait un dépôt ne contenant que cette branche est créé. | ||
+ | |||
+ | Note : Si cela ne vous dérange pas de télécharger toutes les branches existantes et que vous souhaitez seulement que git pointe par défaut vers une autre branche (par exemple si vous prévoyez de fusionner des branches plus tard), vous pouvez le faire beaucoup plus simplement avec : | ||
+ | |||
+ | < | ||
**This clones the repository as normal (including all branches), and then switches the default branch (i.e. master) to the branch you specify (i.e. testing). This would generally be my preference, as opposed to the complicated series of steps listed above. Most likely you'll eventually need access to at least some of the other branches, and this makes it relatively painless to switch between them. | **This clones the repository as normal (including all branches), and then switches the default branch (i.e. master) to the branch you specify (i.e. testing). This would generally be my preference, as opposed to the complicated series of steps listed above. Most likely you'll eventually need access to at least some of the other branches, and this makes it relatively painless to switch between them. | ||
Hopefully this has helped explain some of the intricacies of managing git branches and servers. If you have any follow-up questions, or ran into any issues with the examples in the article, feel free to email me at lswest34+fcm@gmail.com. You're also very welcome to email me with requests for articles, or if you want to offer your 2 cents on any of the steps outlined here.** | Hopefully this has helped explain some of the intricacies of managing git branches and servers. If you have any follow-up questions, or ran into any issues with the examples in the article, feel free to email me at lswest34+fcm@gmail.com. You're also very welcome to email me with requests for articles, or if you want to offer your 2 cents on any of the steps outlined here.** | ||
+ | |||
+ | Avec cette commande, le dépôt est cloné normalement (avec toutes ses branches) et il commute ensuite de la branche par défaut (c' | ||
+ | |||
+ | J' | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ |
issue86/command_conquer.1419345533.txt.gz · Dernière modification : 2014/12/23 15:38 de d52fr