Branchy Django developement on GitHub

8 views
Skip to first unread message

mrts

unread,
Oct 5, 2009, 8:48:44 AM10/5/09
to Django developers
Many core developers and the GSOC folks use GitHub for
Django development, so I hope discussing the best
practices is appropriate for django-dev.

Let me outline the desired workflow, please amend and
correct as you see fit as there are probably errors or
omissions. I expect various useful patterns and workarounds
for problems have emerged which could be shared with the
larger community. I'll create a proper guide in the wiki
once feedback has been collected.

Assumptions
-----------

You want to work on several fixes and features (tasks) and
* keep the changes for a particular task selt-contained in
a branch,
* frequently update the codebase with upstream changes,
* have a has-it-all branch for testing out how the
different task branches interact.

You have created a fork of django/django on GitHub,
`git clone`d the work to local machine, added the upstream
repository with `git remote add upstream`.

Working on a task
-----------------

Goal: keep the changes self-contained, create and update
patches suitable for attaching to tickets in Django trac.

# branch from master
$ git checkout -b ticket1234 master
$ ... change files, commit often ...
$ ... run tests ...
# create the remote branch and push changes into it
$ git push origin ticket1234
# create a patch, attach it to a relevant ticket in trac
$ git diff master > ticket1234.patch

After upstream has changed
--------------------------

Goal: bring in the changes in upstream to a task.

# pull in upstream changes
$ git pull upstream master
$ git checkout ticket1234
# merge, fix any conflicts
$ git merge master
# push changes to GitHub, remote branch assumed to exist
$ git push
# update the patch
$ git diff master > ticket1234.patch

Testing everything in the has-it-all branch
-------------------------------------------

Goal: a place to try out the code from all tasks together.
'master' can not be used for this as it is used for tracking
upstream. This is a temporary branch that can be removed
after testing is done.

$ git checkout -b has-it-all master
$ git merge ticket1234
$ git merge ticket1235
$ ... run tests ...
# delete the branch
$ git checkout master
$ git branch -d has-it-all

------------

This is just a (untested) skeleton. All help in improving it,
adding caveats and tricks most welcome.

Best,
Mart Sõmermaa

Simon Willison

unread,
Oct 5, 2009, 11:46:17 AM10/5/09
to Django developers
Thanks for putting this together - that's a really useful summary of
commands. Any chance you could save it on the wiki somewhere?

Cheers,

Simon

mrts

unread,
Oct 5, 2009, 12:08:12 PM10/5/09
to Django developers
There's http://code.djangoproject.com/wiki/CollaborateOnGithub
that I wrote some time ago, but it doesn't give guidelines for
branchy development.

I will update that page with these instructions, but it would be
excellent if others who have collaborated more intensively via
GitHub could amend the text if needed.

Best,
MS

mrts

unread,
Oct 6, 2009, 7:05:12 AM10/6/09
to Django developers
On Oct 5, 7:08 pm, mrts <mrts.py...@gmail.com> wrote:
> There'shttp://code.djangoproject.com/wiki/CollaborateOnGithub
> I will update that page with these instructions,

Done. Any comments and amendments should probably go to the wiki page
now.

Best,
MS
Reply all
Reply to author
Forward
0 new messages