Mahara UK 2011 Technical Day - Git for Mahara

15
Mahara UK 2011 – Technical Conference 21 st June 2011

description

My presentation/workshop from the Mahara UK 2011 technical day.This gives a quick insight into Git, what git is, some of the useful features of git are, and how it can be used in Mahara.

Transcript of Mahara UK 2011 Technical Day - Git for Mahara

Page 1: Mahara UK 2011 Technical Day - Git for Mahara

Mahara UK 2011 – Technical Conference21st June 2011

Page 2: Mahara UK 2011 Technical Day - Git for Mahara

Andrew Nicols

Git in Mahara

Page 3: Mahara UK 2011 Technical Day - Git for Mahara

Git in Mahara

• What is Git?• Some of the Basics• Remotes• Branch, Branch, Branch!!!• Rebases and Merges• Splitting and Squashing• Other Cool Stuff• Q&A

Page 4: Mahara UK 2011 Technical Day - Git for Mahara

What is Git?

• Free• Open Source• Distributed Version Control System• Every Git Clone is a full-fledged repository

• Complete History• Not network dependent• No requirement for central server• Very fast

Page 5: Mahara UK 2011 Technical Day - Git for Mahara

Some Basics

• git clone

• git init

• git add

• git add –p

• git commit

• git commit --amend

• git log

• git log –stat=500

• git log -p

• git status

• git diff

• git diff --cached

Page 6: Mahara UK 2011 Technical Day - Git for Mahara

Remotes

Git is great for collaborative working

It allows you to have multiple remotes

git remotegit remote showgit remote addgit fetchgit push

Page 7: Mahara UK 2011 Technical Day - Git for Mahara

Branch, Branch, Branch!!!

Branches are cool

Branches don’t suck in Git (yes I know they do in subversion)

git checkout –b <branchname>git branchgit branch --all

Page 8: Mahara UK 2011 Technical Day - Git for Mahara

Rebases and Merges

Rebase rewrites history

Merge combines histories

Rebasing changes the parent of a commit

Don’t use rebase if you’re going to step on someone elses toes

git rebase origin/mastergit rebase gerrit/mastergit merge my_local_branch

Page 9: Mahara UK 2011 Technical Day - Git for Mahara

Rebases and Merges

Page 10: Mahara UK 2011 Technical Day - Git for Mahara

Rebases and Merges

Page 11: Mahara UK 2011 Technical Day - Git for Mahara

Rebases and Merges

Page 12: Mahara UK 2011 Technical Day - Git for Mahara

Rebases and Merges

Page 13: Mahara UK 2011 Technical Day - Git for Mahara

Splitting and Squashing

Re-write your commits before you make them public

Keep things tidy

git edit –i HEAD~3

Page 14: Mahara UK 2011 Technical Day - Git for Mahara

Other Cool Stuff

git grepgit cherry-pickgit format-patchgit bisectgit refloggitkgit shortloggit archive

Page 15: Mahara UK 2011 Technical Day - Git for Mahara

Q&A