A little history
Git is a DVCS, built by Linus Torvalds to manage high
volumes of merges into the Kernel
It emerged after squabbles with the maker of the
commercial BitKeeper VCS.
Git is: Fast, simple, non-linear, distributed
Slide 3
Slide 3 text
DVCS?
Distributed
version
control
system.
Slide 4
Slide 4 text
Git cheatsheet
● git init
○ New self-hosted repo
● git add
○ Stage files for commit
● git commit
○ Commit to local
○ -m “Commit Message”
○ -a
○ -p
Slide 5
Slide 5 text
● git branch
● git checkout
● git pull
○ shorthand for: git pull origin
○ (actually git-fetch, then git-merge)
● git push
○ push changes to origin
○ could be git push
● git log
○ log of commits on current branch
Slide 6
Slide 6 text
Git is unixy
● Git is composed of lots of smaller
executables
○ git commit == git-commit
○ man git-commit
● This means git is extensible
sh-3.2# echo "#\!/bin/bash\necho 'hello polly'" >
/usr/sbin/git-echo
sh-3.2# chmod +x /usr/sbin/git-echo
sh-3.2# git echo
hello polly
Git flow
Best branching strategy.
ever.
● Develop is ±messy.
● Branch features off Develop. (e.g.
feature/new_boondoggle)
● Merge up to Develop.
● Stabilize Develop.
● Merge to master, tag, release.
● Branch hotfixes off master
Master is always a clean, dependable
build.
Slide 9
Slide 9 text
Using git flow
● Supported by some development
environments
● Commandline tools
○ https://github.com/nvie/gitflow
git clone --recursive [email protected]:
/gitflow.git
cd gitflow
git branch master origin/master
git flow init -d
git flow feature start
Slide 10
Slide 10 text
Pull requests?
Encapsulates a set of changes you want to
merge between two repositories or branches.
Groups together a set of logical changes.
Nice UI in Github to interact and review.
Slide 11
Slide 11 text
Github pull requests (Open source)
“Hey, please can someone look over my code”
○ Only maintainers have write access to repo
○ Anyone can clone/fork a repo
○ Make changes to your fork
○ Open a pull request against maintainer’s repo
○ Reviewed and ingested by repo owner(s)
Slide 12
Slide 12 text
Github pull requests (private edition)
“Hey, please can someone look over my code”
● Branch Develop -> feature/my_feature
● code code code commit code code commit
code commit push code code commit push
code commit push
● Instead of merging locally, create pull
request from feature/my_feature ->
Develop
Slide 13
Slide 13 text
● Write a nice descriptive PR
● PR -> Slack channel
● Open for comments
○ Comments can be on PR generally
○ Comments can be on specific changes
○ Comments can just be :+1:
○ Comments can enforce culture
■ “This doesn’t have tests”
■ “This is some fine ass code”
■ “Please rework this to use new interfaces”
● Additional commits to branch are appended
Slide 14
Slide 14 text
Merge the PR
Eventually hit the merge button on the Pull
request to close issue, and merge code.