• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Quick Introduction to git
 

Quick Introduction to git

on

  • 2,207 views

 

Statistics

Views

Total Views
2,207
Views on SlideShare
2,207
Embed Views
0

Actions

Likes
2
Downloads
88
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Quick Introduction to git Quick Introduction to git Presentation Transcript

    • Distributed version control with git— a brief introductionJoel KrebsSlides by Oscar Nierstrasz
    • Why git?
    • Bob
    • Bob Carol
    • Bob CarolAlice Ted
    • Bob CarolAlice Ted A recipe for disaster!
    • What is git?
    • > Distributed revision control system> Originally developed by Linus Torvalds for the development of the Linux Kernel in 2005> Focus on speed and efficiency> Quite a unique design and therefore sometimes a bit scary and difficult to understand
    • The git object model
    • A “blob” is content under version control (a file) blob
    • You can have trees of blobs (directories of files) tree blob tree blob blob
    • A “commit” is a tree of blobs (a set of changes) commit tree blob tree blob blob
    • Most commits modify (or merge) earlier commits commit commit tree tree blobblob treeblob blob
    • You can “tag” aninteresting commit tag commit commit tree tree blob blob tree blob blob
    • A graph of commitsmay belong to a branch branch tag commit commit tree tree blob blob tree blob blob
    • HEAD “HEAD “is the current branch branch tag commit commit tree tree blobblob treeblob blob
    • HEAD branch commit commitLet’s focus on commits and branches
    • Basic git
    • Create a git repo HEAD master C0
    • Tell git to “stage” changesHEADmaster C0
    • HEADmaster Commit your changes C1 C0
    • Collaborating
    • John JaneLocal repo Public repo Local repo master C1 C0
    • John JaneLocal repo Public repo Local repo master master master C1 C1 C1 C0 C0 C0
    • John JaneLocal repo Public repo Local repo master master master C2 C1 C3 C1 C0 C1 C0 C0
    • John Jane Local repo Public repo Local repo master master master C2 C1 C3 C1 C0 C1 C0 C0(nothing new to pull)
    • John JaneLocal repo Public repo Local repo master master master C2 C2 C3 C1 C1 C1 C0 C0 C0
    • John JaneLocal repo Public repo Local repo master master master C2 C2 C3 C2 C1 C1 C1 C0 C0 C0
    • John JaneLocal repo Public repo Local repo master master master C2 C2 C4 C1 C1 C3 C2 C0 C0 C1 C0 NB: git pull = fetch + merge
    • John JaneLocal repo Public repo Local repo master master master C2 C4 C4 C1 C3 C2 C3 C2 C0 C1 C1 C0 C0
    • John JaneLocal repo Public repo Local repo master master master C4 C4 C4 C3 C2 C3 C2 C3 C2 C1 C1 C1 C0 C0 C0
    • Branchingand merging
    • “origin” refers to the remote repo HEAD masterorigin/master C1 C0
    • HEAD masterorigin/master C2 C1 C0
    • HEAD tryout masterorigin/master C2 C1 C0
    • HEAD tryout masterorigin/master C2 C1 NB: git checkout –b … = branch + checkout C0
    • HEAD tryout master C3origin/master C2 C1 C0
    • HEAD tryoutmaster C3 C5 C2 origin/master C1 C4 C6 C0 origin/idea
    • HEAD tryout C7master C3 C5 C2 origin/master C1 C4 C6 C0 origin/idea
    • tryoutHEAD C7master C3 C5 C2 origin/master C1 C4 C6 C0 origin/idea
    • HEAD tryoutmaster C7 C8 C3 C5 C2 origin/master C1 C4 C6 C0 origin/idea
    • HEAD tryout master C7origin/master C8 C3 C5 C2 C1 C4 C6 C0 origin/idea
    • Overview git workflow Remote repository fetch push Local repository pull commit checkout Index (cache) HEAD add Working directory
    • Getting started
    • First steps> Follow instructions on P2 Blog for installation> Send your ssh public key to joel.krebs@students.unibe.ch> Create meaningful commits with according messages> Hints that make your life easier: —Create a .gitignore file —Always pull before you push —Don’t panic when merge conflicts occur
    • More to git
    • More to git …> Merging and mergetool> Squashing commits when merging> Resolving conflicts> User authentication with ssh> gitx and other graphical tools> git configure — remembering your name> git remote — multiple remote repos> github — an open source public repo> …
    • Resources http://git-scm.com/ http://book.git-scm.com/index.html http://gitready.com/ https://github.com/http://www.slideshare.net/chacon/getting-git http://oreilly.com/
    • http://creativecommons.org/licenses/by-sa/3.0/