Git is a source control management system created by Linus Torvalds in 2005 that is distributed, allows for branching, and is very fast. It works by having local repositories that can be synced to remote repositories. Users can create branches to develop features independently and then merge them into the main branch. Useful Git commands include add, commit, push, pull, clone, init and log. Features like stash, rebase, bisect, and cherry-pick allow for flexible workflows. Git is more powerful and distributed than SVN but can be more complicated for beginners.
2. Say what?
Source Control Management
like SVN, CVS,.. but better!
Linus Throvalds (april 2005)
Linux Kernel
Junio Hamano (july 2005)
a stupid person!
8. Our Workflow
git checkout -b cool_feature
do some fun code stuff, drink a mojito
git fetch master
git rebase origin/master
git checkout master
git merge cool_feature
9. Useful commands and files
‣ repository setup
git init
‣ add files to queue for next commit
git add
‣ commit queued files
git commit
‣ push commit(s) to remote repository
git push
‣ fetch changes from remote repository
git pull
‣ clone repository into a local directory
git clone
‣ ignore specific files by adding them here
.gitignore
11. Cool features stash
do some cool stuff
git stash
fix an irritating bug
git commit -a -m “Farewell, you bug!”
git stash apply
do some more cool stuff
12. Cool features rebase
fetch changes from another branch
feature commit 3
master commit 1 commit 2 commit 4
13. Cool features rebase
fetch changes from another branch
1234
commit 3
feature
master commit 1 commit 2 commit 4
124
14. Cool features bisect
Find the code change that introduced a bug
‣ start bisect session
git bisect start
‣ mark current revision as bad
git bisect bad
‣ search a working revision
git log
‣ mark the working one as good
git bisect good revision
‣ bisect until you find the bug
git bisect good/bad
15. Cool features cherry-pick
Apply a change from another commit into current branch
‣ search the right commit
git log
‣ checkout the branch you want
git checkout branch
‣ apply commit into branch
git cherry-pick revision
17. Git vs SVN
Git SVN
Distributed Single Repository
Branches partial checkout
Performance Access Control
Repository size Shorter revision numbers
Powerful,
more GUI tools
little more complicated
18. git-svn
using git local if you have a remote svn repository
use git on your local machine
staging
seperate commits
branches
push your commits to your svn repository