Presentation is loading. Please wait.

Presentation is loading. Please wait.

Git In The Land of Version Control Systems A tutorial on getting git.

Similar presentations


Presentation on theme: "Git In The Land of Version Control Systems A tutorial on getting git."— Presentation transcript:

1 Git In The Land of Version Control Systems A tutorial on getting git

2 Version Control Systems Some History

3 In the beginning RCS

4 Then... CVS & SVN

5 When Linus could scale no more Bitkeeper

6 Which lead to... Git, arch, Bazaar and Mercurial

7 Getting Started ● You need one tool and that's git. – On debian its a package called git-core – You can get the source from http://git-scm.com/ ● But there are others: – Meld – diff viewer – Egg – emacs mode for git – Gitg /gitk – view your emacs tree

8 Configuring git ● There's a file called.gitconfig in your home directory. ● It's an INI-style file which you could edit by hand. But you can always use the git config command instead. ● Things you should set: – Your email and name – Aliases, handy

9 Getting Started On Your Project ● Open a new directory git init ● You should now see a.git directory ● You are on your way :)

10 Getting Started On Your Project ● The.gitignore file is in the root of your git repository. It holds patterns of files you want to ignore like: – # is a comment (e.g. # Rob's gitignore) – ! is a negation (e.g. !a.c everything but a.c) – * is anything (e.g. *.log) – [] denote options (e.g. i.[oa] – ignores i.a and i.o).

11 Git core concepts #1 & 2 #1 Your entire git repository is on your machine. That means everything is local So all operations cost a lot less #2 There is an area before you commit called the stage The stage is how you manage the files pre- commit

12 Getting Working With git git status, git diff, git commit, git branch – do exactly what you they do in svn git add – adds files or parts of files to a commit git checkout – switches from branch to branch git commit – commits your changes to your git repo.

13 Practical: Set up a git repository

14 Sharing the love When you have a git repo you can share it: ● Via SSH ● Via git daemon – not recommended ● Via Apache ● Via github git push sends your changes to a remote repository. git pull gets the changes from another repository git remote manages your list of remote repositories

15 Git core concepts #3 & #4 #3 The.git directory is all you need to share you entire history. 4# Each change is a patchset. They form a directed acyclic graph (as in a set of connected nodes similar to a tree). So given your graph of patchesets I should be able to reconstruct your repository at any point in time.

16 Practical: Share my git repo

17 Git core concepts #5 & #6 #5 Branching is a low cost operation. Merging mostly just works. Branch and merge regularly. #6 When you want to refer to a git commit, use its SHA.

18 Git power Once you get branches some commands start to make sense: ● git stash – need to flip branches before a commit? ● git bisect – work out which patchset killed your build ● git rebase – apply a patch set to a different part of the DAG and change history **CAREFULL!**

19 Git power extras ● Hook scripts, found under.git ● gitk – visual help with your git ● Git Bash completion – handy :) ● git cherry-pick – apply a single patch to your tree

20 Learning more ● Gitcasts - www.gitcasts.comwww.gitcasts.com ● Git ready blog -http://feeds2.feedburner.com/git- ready ● Pragmatic Version Control Using Git – book from the PragProg stable ● Github guides - http://github.com/guides/homehttp://github.com/guides/home


Download ppt "Git In The Land of Version Control Systems A tutorial on getting git."

Similar presentations


Ads by Google