UCLA Git Walkthrough (for Moodle)
Very basic guide how to get GIT set up on Windows or OSX.
Documentation:
Setting up the Environment
Windows
- http://help.github.com/win-set-up-git/
- 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 want to connect to github without SSH you need a token:
- Follow the directions here: Email and Github Tokens
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
- With Github Token
-
git clone https://YOUR_GITHUB_USERNAMEgithub.com/ucla/moodle.git ./YOUR_LOCAL_MOODLE_FOLDER/@
-
- With SSH RSA-key
-
git clone gitgithub.com:ucla/moodle.git ./YOUR_LOCAL_MOODLE_FOLDER/@
-
- With Github Token
Execute the following commands:
git branch TESTgit push origin TESTgit branch STAGEgit push origin STAGEgit branch SSCgit push origin SSC
New Features
-
git clone https://YOUR_GITHUB_USERNAMEgithub.com/ucla/moodle.git ./YOUR_LOCAL_MOODLE_FOLDER/@ git checkout mastergit checkout -b <feature_name>- change file—
git commit -a -m "updating README.txt to include basic git instructions"-
git push origin <feature_name>
(Repeat above 3 steps as needed) git rebase origin/mastergit checkout DEVgit merge --no-ff <feature_name>git push origin DEV
Bug Fixes
- git clone https://YOUR_GITHUB_USERNAME@github.com/ucla/moodle.git ./YOUR_LOCAL_MOODLE_FOLDER/
git checkout DEV- change file
git commit -a -m "updating README.txt to include basic git instructions"git push origin DEV
Get changes onto TEST
git checkout TESTgit merge --no-ff <feature_name>git push origin TEST
Get changes onto STAGE
git checkout STAGEgit merge --no-ff <feature_name>git push origin STAGE
Get changes onto master
git checkout mastergit merge --no-ff <feature_name>git push origin master
Get changes onto SSC
git checkout SSCgit merge --no-ff <feature_name>git push origin SSC
Updating DEV from moodle.org
git checkout DEVgit remote add upstream https://github.com/moodle/moodle.gitgit fetch upstreamgit merge -m "upgrading Moodle to version X.Y" <commit_hash>- START RESOLVE CONFLICTS
git add <conflicted_file>git add <conflicted_file>git commit -m "upgrading Moodle to version X.Y"- DONE RESOLVE CONFLICTS
git push origin DEV