Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
dbacbc72
Kaydet (Commit)
dbacbc72
authored
Şub 17, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Simplified and updated committing code guidelines.
üst
0adf766e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
44 deletions
+47
-44
committing-code.txt
docs/internals/contributing/committing-code.txt
+47
-44
No files found.
docs/internals/contributing/committing-code.txt
Dosyayı görüntüle @
dbacbc72
...
@@ -12,7 +12,7 @@ who wants to contribute code to Django, have a look at
...
@@ -12,7 +12,7 @@ who wants to contribute code to Django, have a look at
Handling pull requests
Handling pull requests
----------------------
----------------------
Since Django is now hosted at GitHub, m
any
patches are provided in the form of
Since Django is now hosted at GitHub, m
ost
patches are provided in the form of
pull requests.
pull requests.
When committing a pull request, make sure each individual commit matches the
When committing a pull request, make sure each individual commit matches the
...
@@ -29,58 +29,57 @@ to standard themselves.
...
@@ -29,58 +29,57 @@ to standard themselves.
.. _Jenkins wiki page: https://code.djangoproject.com/wiki/Jenkins
.. _Jenkins wiki page: https://code.djangoproject.com/wiki/Jenkins
Here is one way to commit a pull request::
An easy way to checkout a pull request locally is to add an alias to your
``~/.gitconfig`` (``upstream`` is assumed to be ``django/django``)::
# Create a new branch tracking upstream/master -- upstream is assumed
[alias]
# to be django/django.
pr = !sh -c \"git fetch upstream pull/${1}/head:pr/${1} && git checkout pr/${1}\"
git checkout -b pull_xxxxx upstream/master
# Download the patches from github and apply them.
Now you can simply run ``git pr ####`` to checkout the corresponding pull
curl https://github.com/django/django/pull/xxxxx.patch | git am
request.
At this point, you can work on the code. Use ``git rebase -i`` and ``git
At this point, you can work on the code. Use ``git rebase -i`` and ``git
commit --amend`` to make sure the commits have the expected level of quality.
commit --amend`` to make sure the commits have the expected level of quality.
Once you're ready::
Once you're ready:
# Make sure master is ready to receive changes.
.. code-block:: console
git checkout master
git pull upstream master
$ # Pull in the latest changes from master.
# Merge the work as "fast-forward" to master, to avoid a merge commit.
$ git checkout master
git merge --ff-only pull_xxxxx
$ git pull upstream master
# Check that only the changes you expect will be pushed to upstream.
$ # Rebase the pull request on master.
git push --dry-run upstream master
$ git checkout pr/####
# Push!
$ git rebase master
git push upstream master
$ git checkout master
$ # Merge the work as "fast-forward" to master to avoid a merge commit.
# Get rid of the pull_xxxxx branch.
$ # (in practice, you can omit "--ff-only" since you just rebased)
git branch -d pull_xxxxx
$ git merge --ff-only pr/XXXX
$ # If you're not sure if you did things correctly, check that only the
An alternative is to add the contributor's repository as a new remote,
$ # changes you expect will be pushed to upstream.
checkout the branch and work from there::
$ git push --dry-run upstream master
$ # Push!
git remote add <contributor> https://github.com/<contributor>/django.git
$ git push upstream master
git checkout pull_xxxxx <contributor> <contributor's pull request branch>
$ # Delete the pull request branch.
$ git branch -d pr/xxxx
Yet another alternative is to fetch the branch without adding the
contributor's repository as a remote::
For changes on your own branches, force push to your fork after rebasing on
master but before merging and pushing to upstream. This allows the commit
git fetch https://github.com/<contributor>/django.git <contributor's pull request branch>
hashes on master and your branch to match which automatically closes the pull
git checkout -b pull_xxxxx FETCH_HEAD
request. Since you can't push to other contributors' branches, comment on the
pull request "Merged in XXXXXXX" (replacing with the commit hash) after you
At this point, you can work on the code and continue as above.
merge it. Trac checks for this message format to indicate on the ticket page
whether or not a pull request is merged.
GitHub provides a one-click merge functionality for pull requests. This should
only be used if the pull request is 100% ready, and you have checked it for
Avoid using GitHub's "Merge pull request" button on the Web site as its creates
errors (or trust the request maker enough to skip checks). Currently, it isn't
an ugly "merge commit" and makes navigating history more difficult.
possible to check that the tests pass and that the docs build without
downloading the changes to your development environment.
When rewriting the commit history of a pull request, the goal is to make
When rewriting the commit history of a pull request, the goal is to make
Django's commit history as usable as possible:
Django's commit history as usable as possible:
* If a patch contains back-and-forth commits, then rewrite those into one.
* If a patch contains back-and-forth commits, then rewrite those into one.
Typically, a commit can add some code, and a second commit can fix
For example, if a commit adds some code and a second commit fixes stylistic
stylistic issues introduced in the first commit.
issues introduced in the first commit, those commits should be squashed
before merging.
* Separate changes to different commits by logical grouping: if you do a
* Separate changes to different commits by logical grouping: if you do a
stylistic cleanup at the same time as you do other changes to a file,
stylistic cleanup at the same time as you do other changes to a file,
...
@@ -93,7 +92,7 @@ Django's commit history as usable as possible:
...
@@ -93,7 +92,7 @@ Django's commit history as usable as possible:
tests nor the docs should emit warnings.
tests nor the docs should emit warnings.
* Trivial and small patches usually are best done in one commit. Medium to
* Trivial and small patches usually are best done in one commit. Medium to
large work
should be split into multiple commits if possibl
e.
large work
may be split into multiple commits if it makes sens
e.
Practicality beats purity, so it is up to each committer to decide how much
Practicality beats purity, so it is up to each committer to decide how much
history mangling to do for a pull request. The main points are engaging the
history mangling to do for a pull request. The main points are engaging the
...
@@ -196,6 +195,10 @@ Django's Git repository:
...
@@ -196,6 +195,10 @@ Django's Git repository:
Backport of 80c0cbf1c97047daed2c5b41b296bbc56fe1d7e3 from master.
Backport of 80c0cbf1c97047daed2c5b41b296bbc56fe1d7e3 from master.
There's a `script on the wiki
<https://code.djangoproject.com/wiki/CommitterTips#AutomatingBackports>`_
to automate this.
Reverting commits
Reverting commits
-----------------
-----------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment