Git Training¶
Git is a distributed version control systems (DVCS) which was used to manange all Teracy’s development resources. You need to learn to use Git to work with Teracy’s projects.
Studying¶
There are many free available resources for you to study git. The followings are some recommended resources:
Practising¶
Prerequisites
- You need to have a github account with configured ssh keys.
teracy-devis running with working ssh ($ ssh -T git@github.comshould be ok).
Git basics
- You are going to create a
pro-git-practicerepository on github (via github’s web UI). - The repository on your VM should be at
workspace/personal/pro-git-practice. - Read the chapter 2 and practice with your
pro-git-practicerepository on your VM at http://git-scm.com/book/en/Git-Basics. - Remember to push the changes to github so we could see your work and practice.
- You are going to create a
Working again on teracy-tutorial
Note
You are encouraged to practice with as many git commands as possible, but have to follow strictly all the instructions below, the results will be displayed on github to check.
As you remember, you practiced to adapt Django’s tutorial into Teracy’s Django boilerplate project.
Now you will continue to work on it with git and push it to github.
Initial setup:
- Create your repository named
teracy-tutorialon github, and set up the local repo `` workspace/personal/teracy-tutorial`` on your VM. - Push this first commit on github (Initial setup).
- Create your repository named
Setting up project layout
- Add the remote repository https://github.com/teracy-official/django-boilerplate.git into
your repository with the
djbpname. - Fetch and merge the
djbp/masterbranch. - Push the merge to your github’s repository at
origin/master.
- Add the remote repository https://github.com/teracy-official/django-boilerplate.git into
your repository with the
Tutorial 01 at https://docs.djangoproject.com/en/1.5/intro/tutorial01/.
- Create a branch named
tutorial01, branch off fromorigin/master. - Checkout the
tutorial01branch - Skip the section of
startprojectas we already started a project withteracy. - Work on the
Creating modelssection and commit the changes with the message:Creating models. - Work on the
Activating modelssection and commit the changes with the message:Activating models. - Work on the
Playing with the APIsection and commit the changes with the message:Playing with the API. - Push the
tutorial01branch toorigin/tutorial01branch.
(You should open the repository on github and see the branch there.)
- Merge (no fast forward) (hint: $ git merge –no-ff) the
tutorial01branch into themasterbranch, then push to theorigin/masterbranch.
- Create a branch named
Tutorial 02 at https://docs.djangoproject.com/en/1.5/intro/tutorial02/.
- Create a branch named
tutorial02, branch off fromorigin/master. - Checkout
tutorial02branch. - Skip
Activate the admin sitesection as admin is activated by teracy’s project layout onsettings/dev.py. - Work on the
Make the poll app modifiable in the adminsection and commit the changes. - Work on the
Customize the admin formsection and commit the changes. - Work on the
Adding related objectssection and commit the changes. - Work on the
Customize the admin change listsection and commit the changes. - Work on the
Customize the admin look and feelsection and commit the changes.
Note
TEMPLATE_DIRS is already configured by
teracy-django-boilerplate, you could just use it.- Work on the
Customize the admin index pagesection and commit the changes. - Push
tutorial02toorigin/tutorial02and see it on github. - Merge no fast forward
tutorial02intomasterand push toorigin/master.
- Create a branch named
Tutorial 03 at https://docs.djangoproject.com/en/1.5/intro/tutorial03/
- Create a branch named
tutorial03, branch off fromorigin/master. - Checkout the
tutorial03branch. - Work on the
Write your first viewsection and commit. - Work on the
Writing more viewssection and commit. - Work on the
Write views that actually do somethingsection and commit. - Work on the
A shortcut: render()section and commit. - Work on the
Raising a 404 errorsection and commit. - Work on the
A shortcut: get_object_or_404()section and commit. - Work on the
Write a 404 (page not found) viewsection and commit. - Work on the
Write a 500 (server error) viewsection and commit. - Work on the
Use the template systemsection and commit. - Work on the
Removing hardcoded URLs in templatessection and commit. - Work on the
Namespacing URL namessection and commit. - Push
tutorial03toorigin/tutorial03and see it on github. - Merge no fast forward
tutorial03intomasterand push toorigin/master.
- Create a branch named
Tutorial 04 at https://docs.djangoproject.com/en/1.5/intro/tutorial04/.
- Create a branch named
tutorial04, branch off fromorigin/master. - Checkout the
tutorial04branch. - Work on the
Write a simple formsection and commit. - Work on the
Use generic views: Less code is bettersection and commit. - Work on the
Amend URLconfsection and commit. - Work on the
Amend viewssection and commit. - Push
tutorial04toorigin/tutorial04and see it on github. - Merge no fast forward
tutorial04intomasterand push toorigin/master.
- Create a branch named
Tutorial 05 at https://docs.djangoproject.com/en/1.5/intro/tutorial05/
- Create a branch named
tutorial05, branch off fromorigin/master. - Checkout the
tutorial05branch. - Work on the
Create a test to expose the bugsection and commit. - Work on the
Fixing the bugsection and commit. - Work on the
More comprehensive testssection and commit. - Work on the
Improving our viewsection and commit. - Work on the
Testing our new viewsection and commit. - Work on the
Testing the DetailViewsection and commit. - Push
tutorial05toorigin/tutorial05and see it on github. - Merge no fast forward
tutorial05intomasterand push toorigin/master.
- Create a branch named
Tutorial 06 at https://docs.djangoproject.com/en/1.5/intro/tutorial06/.
- Create a branch named
tutorial06, branch off fromorigin/master. - Checkout the
tutorial06branch. - Work on the
Customize your app’s look and feelsection and commit. - Work on the
Adding a background-imagesection and commit. - Push
tutorial06toorigin/tutorial06and see it on github. - Merge no fast forward
tutorial06intomasterand push toorigin/master.
- Create a branch named
Congratulations, now you could work with git with basic commands. You will know more about git from time to time when working at Teracy.