{"title":"Travailler avec Git et GitHub","version":"3.0","locale":"fr","docname":"internals/contributing/writing-code/working-with-git","url":"/fr/3.0/internals/contributing/writing-code/working-with-git/","canonical":"https://djangodocs.dev/fr/3.0/internals/contributing/writing-code/working-with-git/","summary":"Cette section explique comment la communauté peur contribuer au code de Django au travers de requêtes de contribution (« pull requests »). SI vous vous intéressez à…","html":"<h1>Travailler avec Git et GitHub<a class=\"heading-anchor\" href=\"#working-with-git-and-github\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>Cette section explique comment la communauté peur contribuer au code de Django au travers de requêtes de contribution (« pull requests »). SI vous vous intéressez à la manière dont les commiteurs les gèrent, consultez <a class=\"reference internal\" href=\"/fr/3.0/internals/contributing/committing-code/\"><span class=\"doc\">Commit de code</span></a>.</p>\n<p>Nous allons montrer ci-dessous comment créer une requête de contribution GitHub contenant les modifications pour un ticket Trac #xxxxx. En créant une requête de contribution totalement complète, vous faciliterez le travail des relecteurs, ce qui augmentera aussi la probabilité de voir votre code intégré dans Django.</p>\n<p>Il est aussi possible de téléverser un correctif traditionnel dans Trac, mais c’est moins pratique pour la relecture.</p>\n<section id=\"installing-git\">\n<h2>Installation de Git<a class=\"heading-anchor\" href=\"#installing-git\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django utilise <a class=\"reference external\" href=\"https://git-scm.com/\">Git</a> comme système de gestion de version. Vous pouvez <a class=\"reference external\" href=\"https://git-scm.com/download\">télécharger</a> Git, mais il est souvent plus simple de l’installer avec le gestionnaire de paquets de votre système d’exploitation.</p>\n<p>Le <a class=\"reference external\" href=\"https://github.com/django/django/\">dépôt GIt</a> de Django est hébergé sur <a class=\"reference external\" href=\"https://github.com/\">GitHub</a>, et nous vous recommandons aussi de travailler avec GitHub.</p>\n<p>Après l’installation de Git, la première chose à faire est de configurer votre nom et votre courriel</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>$ git config --global user.name &quot;Your Real Name&quot;\n$ git config --global user.email &quot;you@email.com&quot;\n</code></pre></div>\n<p>Notez que <code class=\"docutils literal notranslate\"><span class=\"pre\">user.name</span></code> devrait être votre nom réel, pas un alias GitHub. GitHub devrait reconnaître le courriel que vous indiquez dans le champ <code class=\"docutils literal notranslate\"><span class=\"pre\">user.email</span></code>, car il sera utilisé pour associer vos commits avec votre compte GitHub.</p>\n</section>\n<section id=\"setting-up-local-repository\">\n<h2>Configuration d’un dépôt local<a class=\"heading-anchor\" href=\"#setting-up-local-repository\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Un fois votre compte GitHub créé, avec le pseudonyme « GitHub_nick », et <a class=\"reference external\" href=\"https://github.com/django/django/fork\">le dépôt Django cloné</a>, créez une copie locale de votre clone :</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">git</span> <span class=\"n\">clone</span> <span class=\"n\">https</span><span class=\"p\">:</span><span class=\"o\">//</span><span class=\"n\">github</span><span class=\"o\">.</span><span class=\"n\">com</span><span class=\"o\">/</span><span class=\"n\">GitHub_nick</span><span class=\"o\">/</span><span class=\"n\">django</span><span class=\"o\">.</span><span class=\"n\">git</span>\n</code></pre></div>\n<p>This will create a new directory « django », containing a clone of your GitHub\nrepository. The rest of the git commands on this page need to be run within the\ncloned directory, so switch to it now:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">cd</span> <span class=\"n\">django</span>\n</code></pre></div>\n<p>Votre dépôt GitHub sera appelé « origin » dans Git.</p>\n<p>You should also setup <code class=\"docutils literal notranslate\"><span class=\"pre\">django/django</span></code> as an « upstream » remote (that is, tell\ngit that the reference Django repository was the source of your fork of it):</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">git</span> <span class=\"n\">remote</span> <span class=\"n\">add</span> <span class=\"n\">upstream</span> <span class=\"n\">git</span><span class=\"nd\">@github</span><span class=\"o\">.</span><span class=\"n\">com</span><span class=\"p\">:</span><span class=\"n\">django</span><span class=\"o\">/</span><span class=\"n\">django</span><span class=\"o\">.</span><span class=\"n\">git</span>\n<span class=\"n\">git</span> <span class=\"n\">fetch</span> <span class=\"n\">upstream</span>\n</code></pre></div>\n<p>You can add other remotes similarly, for example:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">git</span> <span class=\"n\">remote</span> <span class=\"n\">add</span> <span class=\"n\">akaariai</span> <span class=\"n\">git</span><span class=\"nd\">@github</span><span class=\"o\">.</span><span class=\"n\">com</span><span class=\"p\">:</span><span class=\"n\">akaariai</span><span class=\"o\">/</span><span class=\"n\">django</span><span class=\"o\">.</span><span class=\"n\">git</span>\n</code></pre></div>\n</section>\n<section id=\"working-on-a-ticket\">\n<h2>Working on a ticket<a class=\"heading-anchor\" href=\"#working-on-a-ticket\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Lorsque vous travaillez sur un ticket, créez une nouvelle branche dédiée à ce travail e la basant sur upstream/master</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">git</span> <span class=\"n\">checkout</span> <span class=\"o\">-</span><span class=\"n\">b</span> <span class=\"n\">ticket_xxxxx</span> <span class=\"n\">upstream</span><span class=\"o\">/</span><span class=\"n\">master</span>\n</code></pre></div>\n<p>L’option <code class=\"docutils literal notranslate\"><span class=\"pre\">-b</span></code> crée une branche locale. N’hésitez pas à créer de nouvelles branches même pour les plus petites choses, elles sont prévues pour ça.</p>\n<p>Si par contre vous travailliez sur une correction dans la branche 1.4, vous auriez écrit</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">git</span> <span class=\"n\">checkout</span> <span class=\"o\">-</span><span class=\"n\">b</span> <span class=\"n\">ticket_xxxxx_1_4</span> <span class=\"n\">upstream</span><span class=\"o\">/</span><span class=\"n\">stable</span><span class=\"o\">/</span><span class=\"mf\">1.4</span><span class=\"o\">.</span><span class=\"n\">x</span>\n</code></pre></div>\n<p>On part du principe que le travail se fait sur la branche ticket_xxxxx. Faites des modifications et validez-les par commit</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">git</span> <span class=\"n\">commit</span>\n</code></pre></div>\n<p>When writing the commit message, follow the <a class=\"reference internal\" href=\"/fr/3.0/internals/contributing/committing-code/#committing-guidelines\"><span class=\"std std-ref\">commit message\nguidelines</span></a> to ease the work of the committer. If\nyou’re uncomfortable with English, try at least to describe precisely what the\ncommit does.</p>\n<p>If you need to do additional work on your branch, commit as often as\nnecessary:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">git</span> <span class=\"n\">commit</span> <span class=\"o\">-</span><span class=\"n\">m</span> <span class=\"s1\">&#39;Added two more tests for edge cases&#39;</span>\n</code></pre></div>\n<section id=\"publishing-work\">\n<h3>Publication de votre travail<a class=\"heading-anchor\" href=\"#publishing-work\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Vous pouvez publier votre travail sur GitHub en exécutant</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">git</span> <span class=\"n\">push</span> <span class=\"n\">origin</span> <span class=\"n\">ticket_xxxxx</span>\n</code></pre></div>\n<p>Lorsque vous allez sur votre page GitHub, vous pouvez constater qu’une nouvelle branche a été créée.</p>\n<p>Si vous travaillez à partir d’un ticket Trac, vous devriez mentionner dans le ticket que votre travail est disponible dans la branche ticket_xxxxx de votre dépôt GiHub. Incluez un lien vers votre branche.</p>\n<p>Notez que la branche ci-dessus est appelée une branche thématique (« topic branch ») dans le jargon Git. Vous êtes libre de réécrire l’historique de cette branche, par exemple avec <code class=\"docutils literal notranslate\"><span class=\"pre\">git</span> <span class=\"pre\">rebase</span></code>. D’autres personnes ne devraient pas baser leur travail sur une telle branche, car leur clone serait corrompu dès le moment où vous modifiez des commits.</p>\n<p>Il existe aussi des branches publiques. Ce sont des branches que d’autres personnes sont susceptibles de fourcher, ce qui implique que leur historique ne devrait jamais être altéré. De bons exemples de branches publiques sont les branches <code class=\"docutils literal notranslate\"><span class=\"pre\">master</span></code> et <code class=\"docutils literal notranslate\"><span class=\"pre\">stable/A.B.x</span></code> dans le dépôt <code class=\"docutils literal notranslate\"><span class=\"pre\">django/django</span></code>.</p>\n<p>Lorsque vous pensez que votre travail est prêt à être intégré dans Django, c’est le moment de créer une requête de contribution (pull request) dans GitHub. Une bonne requête de contribution signifie :</p>\n<ul class=\"simple\">\n<li><p>des commits avec chacun son changement logique, respectant le <a class=\"reference internal\" href=\"/fr/3.0/internals/contributing/writing-code/coding-style/\"><span class=\"doc\">style de code</span></a> ;</p></li>\n<li><p>des messages correctement formés pour chaque commit : une ligne de résumé puis des paragraphes de lignes à 72 caractères - consultez les <span class=\"xref std std-ref\">lignes directrices pour les commits</span> pour plus de détails ;</p></li>\n<li><p>de la documentation et des tests, si nécessaire – en réalité, des tests sont toujours nécessaires à l’exception des modifications de documentation.</p></li>\n</ul>\n<p>La suite de tests doit passer et la documentation doit pouvoir être construite sans avertissement.</p>\n<p>Après avoir créà la requête de contribution, vous devriez ajouter un commentaire dans le ticket Trac correspondant en expliquant ce que vous avez fait. En particulier, vous devriez signaler l’environnement dans lequel vous avez lancé les tests, par exemple : « tous les tests passent avec SQLite et MySQL ».</p>\n<p>Les requêtes de contribution de GitHub ont seulement deux états : ouvert et fermé. Le développeur qui s’occupera de cette requête n’a que deux options, la fusionner ou la fermer. C’est pour cela qu’il n’est pas utile de créer une requête de contribution avant que le code soit prêt à être fusionné, ou suffisamment proche de l’être pour qu’un développeur avec droit de commit puisse la terminer lui-même.</p>\n</section>\n<section id=\"rebasing-branches\">\n<h3>Rebasing branches<a class=\"heading-anchor\" href=\"#rebasing-branches\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>In the example above, you created two commits, the « Fixed ticket_xxxxx » commit\nand « Added two more tests » commit.</p>\n<p>We do not want to have the entire history of your working process in your\nrepository. Your commit « Added two more tests » would be unhelpful noise.\nInstead, we would rather only have one commit containing all your work.</p>\n<p>To rework the history of your branch you can squash the commits into one by\nusing interactive rebase:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">git</span> <span class=\"n\">rebase</span> <span class=\"o\">-</span><span class=\"n\">i</span> <span class=\"n\">HEAD</span><span class=\"o\">~</span><span class=\"mi\">2</span>\n</code></pre></div>\n<p>The HEAD~2 above is shorthand for two latest commits. The above command\nwill open an editor showing the two commits, prefixed with the word « pick ».</p>\n<p>Change « pick » on the second line to « squash » instead. This will keep the\nfirst commit, and squash the second commit into the first one. Save and quit\nthe editor. A second editor window should open, so you can reword the\ncommit message for the commit now that it includes both your steps.</p>\n<p>You can also use the « edit » option in rebase. This way you can change a single\ncommit, for example to fix a typo in a docstring:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">git</span> <span class=\"n\">rebase</span> <span class=\"o\">-</span><span class=\"n\">i</span> <span class=\"n\">HEAD</span><span class=\"o\">~</span><span class=\"mi\">3</span>\n<span class=\"c1\"># Choose edit, pick, pick for the commits</span>\n<span class=\"c1\"># Now you are able to rework the commit (use git add normally to add changes)</span>\n<span class=\"c1\"># When finished, commit work with &quot;--amend&quot; and continue</span>\n<span class=\"n\">git</span> <span class=\"n\">commit</span> <span class=\"o\">--</span><span class=\"n\">amend</span>\n<span class=\"c1\"># Reword the commit message if needed</span>\n<span class=\"n\">git</span> <span class=\"n\">rebase</span> <span class=\"o\">--</span><span class=\"k\">continue</span>\n<span class=\"c1\"># The second and third commits should be applied.</span>\n</code></pre></div>\n<p>If your topic branch is already published at GitHub, for example if you’re\nmaking minor changes to take into account a review, you will need to force-push\nthe changes:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">git</span> <span class=\"n\">push</span> <span class=\"o\">-</span><span class=\"n\">f</span> <span class=\"n\">origin</span> <span class=\"n\">ticket_xxxxx</span>\n</code></pre></div>\n<p>Note that this will rewrite history of ticket_xxxxx - if you check the commit\nhashes before and after the operation at GitHub you will notice that the commit\nhashes do not match anymore. This is acceptable, as the branch is a topic\nbranch, and nobody should be basing their work on it.</p>\n</section>\n<section id=\"after-upstream-has-changed\">\n<h3>After upstream has changed<a class=\"heading-anchor\" href=\"#after-upstream-has-changed\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>When upstream (<code class=\"docutils literal notranslate\"><span class=\"pre\">django/django</span></code>) has changed, you should rebase your work. To\ndo this, use:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">git</span> <span class=\"n\">fetch</span> <span class=\"n\">upstream</span>\n<span class=\"n\">git</span> <span class=\"n\">rebase</span>\n</code></pre></div>\n<p>The work is automatically rebased using the branch you forked on, in the\nexample case using <code class=\"docutils literal notranslate\"><span class=\"pre\">upstream/master</span></code>.</p>\n<p>The rebase command removes all your local commits temporarily, applies the\nupstream commits, and then applies your local commits again on the work.</p>\n<p>If there are merge conflicts, you will need to resolve them and then use <code class=\"docutils literal notranslate\"><span class=\"pre\">git</span>\n<span class=\"pre\">rebase</span> <span class=\"pre\">--continue</span></code>. At any point you can use <code class=\"docutils literal notranslate\"><span class=\"pre\">git</span> <span class=\"pre\">rebase</span> <span class=\"pre\">--abort</span></code> to return\nto the original state.</p>\n<p>Note that you want to <em>rebase</em> on upstream, not <em>merge</em> the upstream.</p>\n<p>The reason for this is that by rebasing, your commits will always be <em>on\ntop of</em> the upstream’s work, not <em>mixed in with</em> the changes in the upstream.\nThis way your branch will contain only commits related to its topic, which\nmakes squashing easier.</p>\n</section>\n<section id=\"after-review\">\n<h3>After review<a class=\"heading-anchor\" href=\"#after-review\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>It is unusual to get any non-trivial amount of code into core without changes\nrequested by reviewers. In this case, it is often a good idea to add the\nchanges as one incremental commit to your work. This allows the reviewer to\neasily check what changes you have done.</p>\n<p>In this case, do the changes required by the reviewer. Commit as often as\nnecessary. Before publishing the changes, rebase your work. If you added two\ncommits, you would run:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">git</span> <span class=\"n\">rebase</span> <span class=\"o\">-</span><span class=\"n\">i</span> <span class=\"n\">HEAD</span><span class=\"o\">~</span><span class=\"mi\">2</span>\n</code></pre></div>\n<p>Squash the second commit into the first. Write a commit message along the lines\nof:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">Made</span> <span class=\"n\">changes</span> <span class=\"n\">asked</span> <span class=\"ow\">in</span> <span class=\"n\">review</span> <span class=\"n\">by</span> <span class=\"o\">&lt;</span><span class=\"n\">reviewer</span><span class=\"o\">&gt;</span>\n\n<span class=\"o\">-</span> <span class=\"n\">Fixed</span> <span class=\"n\">whitespace</span> <span class=\"n\">errors</span> <span class=\"ow\">in</span> <span class=\"n\">foobar</span>\n<span class=\"o\">-</span> <span class=\"n\">Reworded</span> <span class=\"n\">the</span> <span class=\"n\">docstring</span> <span class=\"n\">of</span> <span class=\"n\">bar</span><span class=\"p\">()</span>\n</code></pre></div>\n<p>Finally, push your work back to your GitHub repository. Since you didn’t touch\nthe public commits during the rebase, you should not need to force-push:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">git</span> <span class=\"n\">push</span> <span class=\"n\">origin</span> <span class=\"n\">ticket_xxxxx</span>\n</code></pre></div>\n<p>Your pull request should now contain the new commit too.</p>\n<p>Note that the committer is likely to squash the review commit into the previous\ncommit when committing the code.</p>\n</section>\n</section>\n<section id=\"working-on-a-patch\">\n<h2>Travail sur un correctif<a class=\"heading-anchor\" href=\"#working-on-a-patch\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>L’une des manières de contribuer à Django par les développeurs est de réviser des correctifs. Ces correctifs se trouvent habituellement sous la forme de requêtes de contribution (pull request) dans GitHub et peuvent facilement être intégrés dans un dépôt local</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">git</span> <span class=\"n\">checkout</span> <span class=\"o\">-</span><span class=\"n\">b</span> <span class=\"n\">pull_xxxxx</span> <span class=\"n\">upstream</span><span class=\"o\">/</span><span class=\"n\">master</span>\n<span class=\"n\">curl</span> <span class=\"n\">https</span><span class=\"p\">:</span><span class=\"o\">//</span><span class=\"n\">github</span><span class=\"o\">.</span><span class=\"n\">com</span><span class=\"o\">/</span><span class=\"n\">django</span><span class=\"o\">/</span><span class=\"n\">django</span><span class=\"o\">/</span><span class=\"n\">pull</span><span class=\"o\">/</span><span class=\"n\">xxxxx</span><span class=\"o\">.</span><span class=\"n\">patch</span> <span class=\"o\">|</span> <span class=\"n\">git</span> <span class=\"n\">am</span>\n</code></pre></div>\n<p>Cela va créer une nouvelle branche, puis y appliquer les modifications de la requête de contribution. À ce stade, vous pouvez lancer les tests ou faire tout ce qu’il faut pour examiner la qualité du correctif.</p>\n<p>Pour plus de détails sur le travail avec les requêtes de contribution, consultez <a class=\"reference internal\" href=\"/fr/3.0/internals/contributing/committing-code/#handling-pull-requests\"><span class=\"std std-ref\">les lignes directrices pour les commiteurs</span></a>.</p>\n</section>\n<section id=\"summary\">\n<h2>Sommaire<a class=\"heading-anchor\" href=\"#summary\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<ul class=\"simple\">\n<li><p>Travaillez avec GitHub si vous le pouvez.</p></li>\n<li><p>Annoncez votre travail sur le ticket Trac en y ajoutant un lien vers votre branche GitHub.</p></li>\n<li><p>Lorsque vous avez du code qui vous semble prêt, créez une requête de contribution (« pull request »).</p></li>\n<li><p>Préparez vos requêtes de contribution aussi bien que vous le pouvez.</p></li>\n<li><p>Lorsque vous appliquez des corrections à votre travail, utilisez <code class=\"docutils literal notranslate\"><span class=\"pre\">git</span> <span class=\"pre\">rebase</span> <span class=\"pre\">-i</span></code> pour fusionner vos commits.</p></li>\n<li><p>Lorsque le code principal amont a changé, faites <code class=\"docutils literal notranslate\"><span class=\"pre\">git</span> <span class=\"pre\">fetch</span> <span class=\"pre\">upstream;</span> <span class=\"pre\">git</span> <span class=\"pre\">rebase</span></code>.</p></li>\n</ul>\n</section>","rootId":"working-with-git-and-github","toc":[{"title":"Installation de Git","anchor":"installing-git","children":[]},{"title":"Configuration d’un dépôt local","anchor":"setting-up-local-repository","children":[]},{"title":"Working on a ticket","anchor":"working-on-a-ticket","children":[{"title":"Publication de votre travail","anchor":"publishing-work","children":[]},{"title":"Rebasing branches","anchor":"rebasing-branches","children":[]},{"title":"After upstream has changed","anchor":"after-upstream-has-changed","children":[]},{"title":"After review","anchor":"after-review","children":[]}]},{"title":"Travail sur un correctif","anchor":"working-on-a-patch","children":[]},{"title":"Sommaire","anchor":"summary","children":[]}],"breadcrumbs":[{"docname":"internals/index","title":"Fonctionnement interne du projet Django","url":"/fr/3.0/internals/"},{"docname":"internals/contributing/index","title":"Contribuer à Django","url":"/fr/3.0/internals/contributing/"},{"docname":"internals/contributing/writing-code/index","title":"Écriture du code","url":"/fr/3.0/internals/contributing/writing-code/"}],"prev":{"docname":"internals/contributing/writing-code/submitting-patches","title":"Soumission de correctifs","url":"/fr/3.0/internals/contributing/writing-code/submitting-patches/"},"next":{"docname":"internals/contributing/writing-code/javascript","title":"JavaScript","url":"/fr/3.0/internals/contributing/writing-code/javascript/"},"formats":{"html":"/fr/3.0/internals/contributing/writing-code/working-with-git/","markdown":"/fr/3.0/internals/contributing/writing-code/working-with-git.md","json":"/fr/3.0/internals/contributing/writing-code/working-with-git.json"},"source":"https://github.com/django/django/blob/stable/3.0.x/docs/internals/contributing/writing-code/working-with-git.txt","official":"https://docs.djangoproject.com/fr/3.0/internals/contributing/writing-code/working-with-git/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11","1.10","1.9"],"inLocales":["en","zh-hans","fr","ja","id","pt-br","ko","es","el","pl"]}