HOW-TO check out PKP applications from git
- 1 Intro
- 2 Create github.com user
- 3 Delete existing personal forks
- 4 Fork the official omp/pkp-lib repositories
- 5 Clone your personal omp locally
- 6 Set up pkp submodule in your local omp clone
- 7 Add the official repository
- 8 Create development branches
- 9 Start pulling changes
- 10 Make your own changes
- 11 Resources
Once you've completed our Git sub-module tutorial you are ready to start developing for PKP.
This is the official process to check out OMP with the PKP library as a sub-module.
Create github.com user
Go to github.com and create a user account. Log in to your user account.
Delete existing personal forks
First you have to delete existing personal forks of omp/pkp-lib if you have cloned these repositories before. You obviously shouldn't do this when there are still changes in there you don't have in other locations!
- Go to your personal github dashboard.
- In "Your Repositories" select the forks you want to delete.
- Go to Admin tab.
- Down on the page click on "Delete This Repository".
- Repeat these steps for both omp and pkp-lib
Fork the official omp/pkp-lib repositories
- Go to http://github.com/pkp/omp and fork it.
- Go to http://github.com/pkp/pkp-lib and fork it.
- Go to http://github.com/pkp/ojs and fork it.
- Go to http://github.com/pkp/ocs and fork it.
- Go to http://github.com/pkp/harvester and fork it.
Clone your personal omp locally
Please replace "your-pkp-workspace" and "your-user" with the appropriate values.
cd ~/your-pkp-workspace git clone email@example.com:your-user/omp.git omp
Set up pkp submodule in your local omp clone
cd omp/ git submodule init
edit .git/config with your favourite editor and find (or add if it's not there):
[submodule "lib/pkp"] url = firstname.lastname@example.org:pkp/pkp-lib
Change the url to
url = email@example.com:your-user/pkp-lib.git
git submodule update cd lib/pkp/ git checkout master cd ../..
Add the official repository
The 'official' respositories can be compared to the role that PKP's old CVS repositories used to fill. Adding the official branch allows you to synchronize your code with the rest of the team, and should be pulled from before creating a patch or making a commit.
cd lib/pkp/ git remote add official git://github.com/pkp/pkp-lib.git git checkout master git pull official master cd ../.. git remote add official git://github.com/pkp/omp.git git checkout master git pull official master
Create development branches
Create development branches in the main project and the sub-module. I'll use the branch "modal" here but this is arbitrary. The branch name should represent the development topic you intend to work on.
git branch modal git checkout modal cd lib/pkp/ git branch modal git checkout modal cd ../..
Never develop directly on the master branch. We use the master branch to track our central CVS repository. Only "official" changes from the CVS should be pulled into master.
Start pulling changes
Now you can start pulling in changes from other people's repositories. The following is just an example. See for yourself what others are working on and pull in what you need to get started.
cd lib/pkp git remote add juan \ git://github.com/jalperin/pkp-lib.git git pull juan modal cd ../.. git remote add juan \ git://github.com/jalperin/omp.git git pull juan modal
You may get merge conflicts, if the repository you pull from did not merge in all changes from CVS already. See man git-merge for more info on how to solve merge conflicts. If you want to use another developer's code without merging it into your branch, you'll want to pull their branch onto a clean branch--Switch to the master branch (use 'git stash' if you have uncommitted changes you want to save) and create a fresh branch, e.g. execute:
git stash save "Temporarily stashing code" git checkout master git pull official master git checkout -b juanModal git pull juan modal ......Play with Juan's code....... git checkout modal git stash pop
Make your own changes
Make your own changes, publish them to your own repository for others to pull from
touch my-new-file.tmp git add my-new-file.tmp git commit -a -m "added a useless file" git push origin modal
That's all. Enjoy developing PKP applications on git!