{"title":"Menyerahkan kode","version":"1.9","locale":"id","docname":"internals/contributing/committing-code","url":"/id/1.9/internals/contributing/committing-code/","canonical":"https://djangodocs.dev/id/1.9/internals/contributing/committing-code/","summary":"Bagian ini dialamatkan ke Committers dan siapapun yang tertatik dalam mengetahui bagaimana kode didiserahkan kedalam inti Django.","html":"<h1>Menyerahkan kode<a class=\"heading-anchor\" href=\"#committing-code\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>Bagian ini dialamatkan ke <a class=\"reference internal\" href=\"/id/1.9/internals/roles/#committers\"><span class=\"std std-ref\">Committers</span></a> dan siapapun yang tertatik dalam mengetahui bagaimana kode didiserahkan kedalam inti Django. Jika anda adalah anggota komunitas yang ingin membantu kode pada Django, lihatlah ini <a class=\"reference internal\" href=\"/id/1.9/internals/contributing/writing-code/working-with-git/\"><span class=\"doc\">Bekerja dengan Git dan GitHub</span></a> sebagai gantinya.</p>\n<section id=\"handling-pull-requests\">\n<span id=\"id1\"></span><h2>Penanganan permintaan tarik<a class=\"heading-anchor\" href=\"#handling-pull-requests\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Sejak Django sekarang disimpan pada Github, kebanyakan tambalan disediakan di formulir permintaan tarik.</p>\n<p>Ketika menyerahkan permintaan menarik, pastikan setiap penyerahan individu cocok dengan panduan penyerahan digambarkan dibawah. Penyumbang diharapkan untuk menyediakan kemungkinan permintaan menarik terbaik. Dalam praktiknya bagaimanapun, penyerah - yang akan lebih akrab dengan panduan penyerahan - mungkin memutuskan membawa penyerahan ke standar mereka sendiri.</p>\n<aside class=\"admonition admonition-note\" role=\"note\">\n<p class=\"admonition-title\">Catatan</p>\n<p>Sebelum menggabungkan, tetapi setelah meninjau, lakukan percobaan Jenkins menarik permintaan dengan mengkomentarkan &quot;buildbot, test this please&quot; pada PR. Lihat <a class=\"reference external\" href=\"https://code.djangoproject.com/wiki/Jenkins\">Jenkins wiki page</a> kami untuk lebih rinci.</p>\n</aside>\n<p>Sebuah cara mudah untuk memeriksa penarikan permintaan secara lokal adalah sebuah alias pada <code class=\"docutils literal notranslate\">~/.gitconfig</code> anda (<code class=\"docutils literal notranslate\">upstream</code> dianggap menjadi <code class=\"docutils literal notranslate\">django/django</code>):</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>[alias]\n    pr = !sh -c \\&quot;git fetch upstream pull/${1}/head:pr/${1} &amp;&amp; git checkout pr/${1}\\&quot;\n</code></pre></div>\n<p>Sekarang anda dapat dengan mudah menjalankan <code class=\"docutils literal notranslate\">git pr ####</code> untuk memeriksa permintaan tarik terhubung.</p>\n<p>Pada titik ini, anda dapat bekerja pada kode. Gunakan <code class=\"docutils literal notranslate\">git rebase -i</code> dan <code class=\"docutils literal notranslate\">git commit --amend</code> untuk memastikan penyerahan mempunyai tingkatan yang diharapkan dari kualitas. Sekali anda sedang siap:</p>\n<div class=\"code-block\" data-language=\"console\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Shell</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=\"Shell code\"><code><span class=\"gp\">$ </span><span class=\"c1\"># Pull in the latest changes from master.</span>\n<span class=\"gp\">$ </span>git checkout master\n<span class=\"gp\">$ </span>git pull upstream master\n<span class=\"gp\">$ </span><span class=\"c1\"># Rebase the pull request on master.</span>\n<span class=\"gp\">$ </span>git checkout pr/####\n<span class=\"gp\">$ </span>git rebase master\n<span class=\"gp\">$ </span>git checkout master\n<span class=\"gp\">$ </span><span class=\"c1\"># Merge the work as &quot;fast-forward&quot; to master to avoid a merge commit.</span>\n<span class=\"gp\">$ </span><span class=\"c1\"># (in practice, you can omit &quot;--ff-only&quot; since you just rebased)</span>\n<span class=\"gp\">$ </span>git merge --ff-only pr/XXXX\n<span class=\"gp\">$ </span><span class=\"c1\"># If you&#39;re not sure if you did things correctly, check that only the</span>\n<span class=\"gp\">$ </span><span class=\"c1\"># changes you expect will be pushed to upstream.</span>\n<span class=\"gp\">$ </span>git push --dry-run upstream master\n<span class=\"gp\">$ </span><span class=\"c1\"># Push!</span>\n<span class=\"gp\">$ </span>git push upstream master\n<span class=\"gp\">$ </span><span class=\"c1\"># Delete the pull request branch.</span>\n<span class=\"gp\">$ </span>git branch -d pr/xxxx\n</code></pre></div>\n<p>For changes on your own branches, force push to your fork after rebasing on\nmaster but before merging and pushing to upstream. This allows the commit\nhashes on master and your branch to match which automatically closes the pull\nrequest. Since you can't push to other contributors' branches, comment on the\npull request &quot;Merged in XXXXXXX&quot; (replacing with the commit hash) after you\nmerge it. Trac checks for this message format to indicate on the ticket page\nwhether or not a pull request is merged.</p>\n<p>Hindari menggunakan tombol &quot;Merge pull request&quot; Github pada website karena akan membuat &quot;merge commit&quot; yang tidak baik dan membuat navigasi riwayat lebih susah.</p>\n<p>Ketika menulis kembali riwayat commit dari pull request, tujuannya adalah membuat riwayat commit django sebaik mungkin:</p>\n<ul class=\"simple\">\n<li><p>If a patch contains back-and-forth commits, then rewrite those into one.\nFor example, if a commit adds some code and a second commit fixes stylistic\nissues introduced in the first commit, those commits should be squashed\nbefore merging.</p></li>\n<li><p>Separate changes to different commits by logical grouping: if you do a\nstylistic cleanup at the same time as you do other changes to a file,\nseparating the changes into two different commits will make reviewing\nhistory easier.</p></li>\n<li><p>Waspada dari menggabungkan cabang hulu dalam permintaan tarikan.</p></li>\n<li><p>Percobaan harus dilewati dan dokumen harus dibangun setelah setiap penyerahan. Juga tidak percobaan maupun dokumen harus mengeluarkan peringatan.</p></li>\n<li><p>Tambalan sepele dan kecil biasanya baik diselesaikan dalam satu penyerahan. Pekerjaan menengah sampai besar mungkin dipisah menjadi banyak penyerahan jika itu masuk akal.</p></li>\n</ul>\n<p>Practicality beats purity, so it is up to each committer to decide how much\nhistory mangling to do for a pull request. The main points are engaging the\ncommunity, getting work done, and having a usable commit history.</p>\n</section>\n<section id=\"committing-guidelines\">\n<span id=\"id2\"></span><h2>Panduan penyerahan<a class=\"heading-anchor\" href=\"#committing-guidelines\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>In addition, please follow the following guidelines when committing code to\nDjango's Git repository:</p>\n<ul>\n<li><p>Never change the published history of django/django branches! <strong>Never force-\npush your changes to django/django.</strong> If you absolutely must (for security\nreasons for example) first discuss the situation with the core team.</p></li>\n<li><p>For any medium-to-big changes, where &quot;medium-to-big&quot; is according to\nyour judgment, please bring things up on the <a class=\"reference internal\" href=\"/id/1.9/internals/mailing-lists/#django-developers-mailing-list\"><span class=\"std std-ref\">django-developers</span></a>\nmailing list before making the change.</p>\n<p>If you bring something up on <a class=\"reference internal\" href=\"/id/1.9/internals/mailing-lists/#django-developers-mailing-list\"><span class=\"std std-ref\">django-developers</span></a> and nobody responds,\nplease don't take that to mean your idea is great and should be\nimplemented immediately because nobody contested it. Django's core\ndevelopers don't have a lot of time to read mailing-list discussions\nimmediately, so you may have to wait a couple of days before getting a\nresponse.</p>\n</li>\n<li><p>Write detailed commit messages in the past tense, not present tense.</p>\n<ul class=\"simple\">\n<li><p>Bagus: &quot;Memperbaiki kesalahan Unicode dalam API RSS.&quot;</p></li>\n<li><p>Buruk: &quot;Memperbaiki kesalahan Unicode dalam API RSS.&quot;</p></li>\n<li><p>Buruk: &quot;Memperbaiki kesalahan Unicode dalam API RSS.&quot;</p></li>\n</ul>\n<p>The commit message should be in lines of 72 chars maximum. There should be\na subject line, separated by a blank line and then paragraphs of 72 char\nlines. The limits are soft. For the subject line, shorter is better. In the\nbody of the commit message more detail is better than less:</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>Fixed <span class=\"c1\">#18307 -- Added git workflow guidelines</span>\n\nRefactored the Django<span class=\"s1\">&#39;s documentation to remove mentions of SVN</span>\nspecific tasks<span class=\"o\">.</span> Added guidelines of how to use Git<span class=\"p\">,</span> GitHub<span class=\"p\">,</span> <span class=\"ow\">and</span>\nhow to use pull request together <span class=\"k\">with</span> Trac instead<span class=\"o\">.</span>\n</code></pre></div>\n<p>If the patch wasn't a pull request, you should credit the contributors in\nthe commit message: &quot;Thanks A for report, B for the patch and C for the\nreview.&quot;</p>\n</li>\n<li><p>For commits to a branch, prefix the commit message with the branch name.\nFor example: &quot;[1.4.x] Fixed #xxxxx -- Added support for mind reading.&quot;</p></li>\n<li><p>Limit commits to the most granular change that makes sense. This means,\nuse frequent small commits rather than infrequent large commits. For\nexample, if implementing feature X requires a small change to library Y,\nfirst commit the change to library Y, then commit feature X in a\nseparate commit. This goes a <em>long way</em> in helping all Django core\ndevelopers follow your changes.</p></li>\n<li><p>Pisahkan perbaikan kesalahan dari perubahan fitur. Perbaikan kesalahan mungkin butuh disambungkan ke cabang stabil, menurut <a class=\"reference internal\" href=\"/id/1.9/internals/release-process/#backwards-compatibility-policy\"><span class=\"std std-ref\">kebijakan kecocokan-sebelumnya</span></a>.</p></li>\n<li><p>If your commit closes a ticket in the Django <a class=\"reference external\" href=\"https://code.djangoproject.com/\">ticket tracker</a>, begin\nyour commit message with the text &quot;Fixed #xxxxx&quot;, where &quot;xxxxx&quot; is the\nnumber of the ticket your commit fixes. Example: &quot;Fixed #123 -- Added\nwhizbang feature.&quot;. We've rigged Trac so that any commit message in that\nformat will automatically close the referenced ticket and post a comment\nto it with the full commit message.</p>\n<p>If your commit closes a ticket and is in a branch, use the branch name\nfirst, then the &quot;Fixed #xxxxx.&quot; For example:\n&quot;[1.4.x] Fixed #123 -- Added whizbang feature.&quot;</p>\n<p>Untuk ingin tahu, kami menggunakan <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>Tambahan Trac <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">`</span></a>_ untuk ini.</p>\n</li>\n</ul>\n<aside class=\"admonition admonition-note\" role=\"note\">\n<p class=\"admonition-title\">Catatan</p>\n<p>Note that the Trac integration doesn't know anything about pull requests.\nSo if you try to close a pull request with the phrase &quot;closes #400&quot; in your\ncommit message, GitHub will close the pull request, but the Trac plugin\nwill also close the same numbered ticket in Trac.</p>\n</aside>\n<ul>\n<li><p>If your commit references a ticket in the Django <a class=\"reference external\" href=\"https://code.djangoproject.com/\">ticket tracker</a> but\ndoes <em>not</em> close the ticket, include the phrase &quot;Refs #xxxxx&quot;, where &quot;xxxxx&quot;\nis the number of the ticket your commit references. This will automatically\npost a comment to the appropriate ticket.</p></li>\n<li><p>Tulis pesan commit untuk backport menggunakan pola berikut:</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=\"p\">[</span><span class=\"o\">&lt;</span>Django version<span class=\"o\">&gt;</span><span class=\"p\">]</span> Fixed <span class=\"o\">&lt;</span>ticket<span class=\"o\">&gt;</span> <span class=\"o\">--</span> <span class=\"o\">&lt;</span>description<span class=\"o\">&gt;</span>\n\nBackport of <span class=\"o\">&lt;</span>revision<span class=\"o\">&gt;</span> <span class=\"kn\">from</span> <span class=\"o\">&lt;</span>branch<span class=\"o\">&gt;.</span>\n</code></pre></div>\n<p>Sebagai contoh:</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=\"p\">[</span><span class=\"mf\">1.3</span><span class=\"o\">.</span>x<span class=\"p\">]</span> Fixed <span class=\"c1\">#17028 -- Changed diveintopython.org -&gt; diveintopython.net.</span>\n\nBackport of <span class=\"mi\">80</span>c0cbf1c97047daed2c5b41b296bbc56fe1d7e3 <span class=\"kn\">from</span> <span class=\"nn\">master.</span>\n</code></pre></div>\n<p>Terdapat tulisan pada wiki &lt;<a class=\"reference external\" href=\"https://code.djangoproject.com/wiki/CommitterTips#AutomatingBackports\">https://code.djangoproject.com/wiki/CommitterTips#AutomatingBackports</a>&gt;`_ untuk mengotomatisasi ini.</p>\n</li>\n</ul>\n</section>\n<section id=\"reverting-commits\">\n<h2>Reverting commits<a class=\"heading-anchor\" href=\"#reverting-commits\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Tidak seorangpun sempurna; kesalahan akan diserahkan.</p>\n<p>But try very hard to ensure that mistakes don't happen. Just because we have a\nreversion policy doesn't relax your responsibility to aim for the highest\nquality possible. Really: double-check your work, or have it checked by\nanother committer, <strong>before</strong> you commit it in the first place!</p>\n<p>When a mistaken commit is discovered, please follow these guidelines:</p>\n<ul class=\"simple\">\n<li><p>Jika memungkinkan, penulis asli mengembalikan penyerahan mereka sendiri.</p></li>\n<li><p>Don't revert another author's changes without permission from the\noriginal author.</p></li>\n<li><p>Use git revert -- this will make a reverse commit, but the original\ncommit will still be part of the commit history.</p></li>\n<li><p>If the original author can't be reached (within a reasonable amount\nof time -- a day or so) and the problem is severe -- crashing bug,\nmajor test failures, etc. -- then ask for objections on the\n<a class=\"reference internal\" href=\"/id/1.9/internals/mailing-lists/#django-developers-mailing-list\"><span class=\"std std-ref\">django-developers</span></a> mailing list then revert if there are none.</p></li>\n<li><p>If the problem is small (a feature commit after feature freeze,\nsay), wait it out.</p></li>\n<li><p>If there's a disagreement between the committer and the\nreverter-to-be then try to work it out on the <a class=\"reference internal\" href=\"/id/1.9/internals/mailing-lists/#django-developers-mailing-list\"><span class=\"std std-ref\">django-developers</span></a>\nmailing list. If an agreement can't be reached then it should\nbe put to a vote.</p></li>\n<li><p>If the commit introduced a confirmed, disclosed security\nvulnerability then the commit may be reverted immediately without\npermission from anyone.</p></li>\n<li><p>The release branch maintainer may back out commits to the release\nbranch without permission if the commit breaks the release branch.</p></li>\n<li><p>If you mistakenly push a topic branch to django/django, just delete it.\nFor instance, if you did: <code class=\"docutils literal notranslate\">git push upstream feature_antigravity</code>,\njust do a reverse push: <code class=\"docutils literal notranslate\">git push upstream :feature_antigravity</code>.</p></li>\n</ul>\n</section>","rootId":"committing-code","toc":[{"title":"Penanganan permintaan tarik","anchor":"handling-pull-requests","children":[]},{"title":"Panduan penyerahan","anchor":"committing-guidelines","children":[]},{"title":"Reverting commits","anchor":"reverting-commits","children":[]}],"breadcrumbs":[{"docname":"internals/index","title":"Dalam Django","url":"/id/1.9/internals/"},{"docname":"internals/contributing/index","title":"Membantu untuk Django","url":"/id/1.9/internals/contributing/"}],"prev":{"docname":"internals/contributing/localizing","title":"Localizing Django","url":"/id/1.9/internals/contributing/localizing/"},"next":{"docname":"internals/mailing-lists","title":"Daftar penyuratan","url":"/id/1.9/internals/mailing-lists/"},"formats":{"html":"/id/1.9/internals/contributing/committing-code/","markdown":"/id/1.9/internals/contributing/committing-code.md","json":"/id/1.9/internals/contributing/committing-code.json"},"source":"https://github.com/django/django/blob/stable/1.9.x/docs/internals/contributing/committing-code.txt","official":"https://docs.djangoproject.com/id/1.9/internals/contributing/committing-code/","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","fr","ja","id","pt-br","es"]}