Hi Pierre,
find below my way of working (to be tested in the next days) with Moodle and Git:
- Carefully read about Git, having started with "Version Control with Git" (978-0-596-52012-0) and Pro Git;
- Git requires attention to define a workflow to work with: Moodle get into SCRUM, some proposals, not to mention other git experiences;
- Prepare the environment:
- GitHub account to share your local work when it will be ready;
- Windows w/ msysgit and TortoiseGit (+TortoiseSVN TortoisePlink + PuTTYgen + Pageant);
- Linux w/ git and SSH Keys/ssh-agent;
- Fork Moodle repo;
- Fork Moodle on GitHb;
- Create at least two Moodle separate environments, 2.0 and 1.9 respectively;
- Configure the previous point by mapping two git repos as in the table below. I guess that there's no need to keep my GitHub fork main branches up to date with the parent ones: remotes should be my friend and they should help to save disk space since I'm using a free account;
- Work exclusively with branches. Lurking at different GitHub Moodle-forks repos it seems the naming convention is: [wip_][<Tracker ref>_][m<Moodle branch version if needed, e.g.: 19, 20>_]<branch goal short description>. wip_ will be used when in work in progress i.e.:
- you've just started working and you've been in the need to share your partial work;
- you're not sure about your proposal: it works but... share the doubts into the Tracker;
- Be prepared to solve issues about merge failures, rebasing, ...
My Moodle Git repos first setup and following work packages:
Task | Moodle 2.0 | Moodle 1.9 |
Clone Moodle Git repo from GitHub fork |
git clone git@github.com:<username>/moodle.git moodle-20 cd moodle-20 git config --global user.name "Your Name" git config --global user.email yourmail@domain.tld |
git clone git@github.com:<username>/moodle.git moodle-19 cd moodle-19 git config --global user.name "Your Name" git config --global user.email yourmail@domain.tld |
Track Moodle main repo | git remote add moodle git://git.moodle.org/moodle.git git fetch moodle git branch --track master-moodle moodle/master |
git remote add -t MOODLE_19_STABLE -m MOODLE_19_STABLE moodle git://git.moodle.org/moodle.git git fetch moodle git branch --track MOODLE_19_STABLE-moodle moodle/MOODLE_19_STABLE |
Track Moodle integration repo | git remote add integration git://git.moodle.org/integration.git git fetch integration git branch --track master-integration integration/master |
git remote add -t MOODLE_19_STABLE -m MOODLE_19_STABLE integration git://git.moodle.org/integration.git git fetch integration git branch --track MOODLE_19_STABLE-integration moodle/MOODLE_19_STABLE |
Show branches | git branch | |
Update remotes (ALL) |
git remote update | |
Look at what has been cooked in the kitchen | git diff master-moodle...master-integration | git diff MOODLE_19_STABLE-moodle...MOODLE_19_STABLE-integration |
Checkout current stable master | git checkout master-moodle | git checkout MOODLE_19_STABLE-moodle |
Create a WIP branch | git branch wip_[<Tracker ref>_][m20_]<branch goal short description> git checkout wip_[<Tracker ref>_][m20_]<branch goal short description> |
git branch wip_[<Tracker ref>_][m19_]<branch goal short description> git checkout wip_[<Tracker ref>_][m19_]<branch goal short description> |
Start working |
git status |
|
Optionally update (ff) your WIP branch on the next run |
git checkout wip_[<Tracker ref>_][m20_]<branch goal short description> git merge moodle/master-moodle |
git checkout wip_[<Tracker ref>_][m19_]<branch goal short description> git merge moodle/MOODLE_19_STABLE-moodle |
Optionally rename your WIP branch |
git branch -m wip_[<Tracker ref>_][m20_]<branch goal short description> [<Tracker ref>_][m20_]<branch goal short description> | git branch -m wip_[<Tracker ref>_][m19_]<branch goal short description> [<Tracker ref>_][m19_]<branch goal short description> |
Publish/Update the branch and give refs into the Tracker + Test Cases |
git push origin [<Tracker ref>_][m20_]<branch goal short description> | git push origin [<Tracker ref>_][m19_]<branch goal short description> |
Optionally track your remote branch (required if you're the only one able to push on it?) |
git config branch.[<Tracker ref>_][m20_]<branch goal short description>.remote origin git config branch.[<Tracker ref>_][m20_]<branch goal short description>.merge refs/heads/[<Tracker ref>_][m20_]<branch goal short description> |
git config branch.[<Tracker ref>_][m19_]<branch goal short description>.remote origin git config branch.[<Tracker ref>_][m19_]<branch goal short description>.merge refs/heads/[<Tracker ref>_][m19_]<branch goal short description> |
Feedbacks are welcome! I'm at the very beginning...
HTH,
Matteo