Git Development Workflow
This is a first draft, very basic guide how to get GIT setup on windows or osx, and commit code to TEST.
Documentation:
Setting up the Environment
Windows
Install msysgit
- Download latest version from http://code.google.com/p/msysgit/downloads/list (ie: Git-1.7.4-preview20110204.exe)
- check “Git Bash Here”
- check “Git GUI Here”
Run Git from the Windows Command Prompt
- checkout as-is, commit unix-style line endings
Install tortoise
- OpenSSH, git default ssh client
Mac OSX
Install Git for OSX:
- Standalone package:
- Grab the latest git installer for your version of osx from Git for OSX
- Run the contained pkg
- If you want git to be accessible via the PATH and MANPATH variables for non-terminal programs, run the included shell script.
- MacPorts:
- sudo port install git-core
Generate an SSH Key:
- Follow the directions here: Mac Key Setup
Configure Line Endings
- In order to avoid issues with line endings when cloning on to Windows machines, follow the directions here: Dealing with line endings
Setting up Git global configs
Before making commits, it is useful to add your name and email:
- git config —global user.name “Your Name”
- git config —global user.email “yourmail@domain.tld”
If you connect to github without ssh you might need a token:
- Follow the directions here: Email Settings
Setting up github repository:
- Go to https://github.com/moodle/moodle, click “fork”
- Got to Admin→Collaborators→Add (add any number of collaborators to the project)
- Checkout a local copy of the forked code: git clone https://YOUR_GITHUB_USERNAME@github.com/ccle/moodle.git ./YOUR_LOCAL_MOODLE_FOLDER/
Execute the following commands:
-
git branch TEST 5221d1b56933dce05a3fde345a2919575fcf6e33(2.0.1) git push origin TEST-
git branch STAGE 5221d1b56933dce05a3fde345a2919575fcf6e33(2.0.1) git push origin STAGE-
git branch PROD 5221d1b56933dce05a3fde345a2919575fcf6e33(2.0.1) git push origin PROD
Get changes onto DEV
- git clone https://YOUR_GITHUB_USERNAME@github.com/ccle/moodle.git ./YOUR_LOCAL_MOODLE_FOLDER/
git checkout DEV- (OPTIONAL)
git checkout -b <feature_name> - change file
git commit -a -m "updating README.txt to include basic git instructions"-
git push origin DEV(or feature_name if working on a feature branch)
if working on feature branch:
git checkout DEVgit merge --no-ff <feature_name>git push
Then:
git checkout TESTgit merge DEV- (OPTIONAL)
git branch -d <feature_branch> git push
Get changes onto TEST
git checkout TESTgit cherry-pick e9cb5git cherry-pick d40dc- Repeat as necessary to get all the changes
git pull origin TESTgit push origin TEST
Updating Master from moodle.org
git checkout mastergit remote add upstream https://github.com/moodle/moodle.gitgit pull upstream mastergit push origin master