Slide 1

Slide 1 text

Git crash course A Git crash course for centralized VCS users Lucas Saldanha® - http://www.lucassaldanha.com 1

Slide 2

Slide 2 text

Agenda • What is Git • Installation and Configuration • First Steps Lucas Saldanha® - http://www.lucassaldanha.com 2

Slide 3

Slide 3 text

Git history • Created in 2005 • Developed by Linus Torvalds • Developed to help the Linux development team • Fast • Simple design • Great support to parallel development • Totally distributed Lucas Saldanha® - http://www.lucassaldanha.com 3

Slide 4

Slide 4 text

Why Git? • Complete local repository • Fast operations (almost everything is offline) • Fast and painless context switch (branches) • Automatic three-way merge • Diversity of workflows • Git repositories are considerably smaller than SVN repositories Lucas Saldanha® - http://www.lucassaldanha.com 4

Slide 5

Slide 5 text

Basic concepts • Deltas vs. Snapshots • Git areas • File state Lucas Saldanha® - http://www.lucassaldanha.com 5

Slide 6

Slide 6 text

Deltas (Image taken from http://git-scm.com/book/en/v2/) Lucas Saldanha® - http://www.lucassaldanha.com 6

Slide 7

Slide 7 text

Snapshots (Image taken from http://git-scm.com/book/en/v2/) Lucas Saldanha® - http://www.lucassaldanha.com 7

Slide 8

Slide 8 text

Git areas (Image taken from http://git-scm.com/book/en/v2/) Lucas Saldanha® - http://www.lucassaldanha.com 8

Slide 9

Slide 9 text

File state (Image taken from http://git-scm.com/book/en/v2/) Lucas Saldanha® - http://www.lucassaldanha.com 9

Slide 10

Slide 10 text

Installing Git • Installers for Linux, Mac and Windows • Linux: http://git-scm.com/download/linux • OSX: http://git-scm.com/download/mac • Windows: http://git-scm.com/download/win Lucas Saldanha® - http://www.lucassaldanha.com 10

Slide 11

Slide 11 text

Configuring Git • git config --global user.name ”Your Name" • git config --global user.email [email protected] • git config --global core.editor vim • More configurations on http://git-scm.com/book/zh/v2/Customizing- Git-Git-Configuration Lucas Saldanha® - http://www.lucassaldanha.com 11

Slide 12

Slide 12 text

Configuring Authentication • HTTPS • git config credential.helper‘cache --timeout=x’ (x in seconds) • SSH • Generatiog SSH key: http://git-scm.com/book/zh/v2/Git-on-the-Server- Generating-Your-SSH-Public-Key Lucas Saldanha® - http://www.lucassaldanha.com 12

Slide 13

Slide 13 text

Your first repository • Creating a local repository • Cloning a remote repository • Ignoring files Lucas Saldanha® - http://www.lucassaldanha.com 13

Slide 14

Slide 14 text

Working with your repository • Checking files status • Adding files • Staging • Commiting • Removing files Lucas Saldanha® - http://www.lucassaldanha.com 14

Slide 15

Slide 15 text

Repository history • Commits log • Difference between author and committer • Looking the changes graph • Applying filters in the log Lucas Saldanha® - http://www.lucassaldanha.com 15

Slide 16

Slide 16 text

Undoing things • “Fixing” a commit • Unstaging • Rollback changes Lucas Saldanha® - http://www.lucassaldanha.com 16

Slide 17

Slide 17 text

Remote repositories • List • Add • Fetch • Pull • Push Lucas Saldanha® - http://www.lucassaldanha.com 17

Slide 18

Slide 18 text

Branches • Hot it works • Creating a branch • Switching between branches • Removing a branch Lucas Saldanha® - http://www.lucassaldanha.com 18

Slide 19

Slide 19 text

Tags • Tags types • Lightweight • Annotated • Signed • Listing • Creating Lucas Saldanha® - http://www.lucassaldanha.com 19

Slide 20

Slide 20 text

Merging • Fast forward • Merging without conflicts • Merging with conflicts Lucas Saldanha® - http://www.lucassaldanha.com 20

Slide 21

Slide 21 text

Remote branches • Pushing branches to a remote server • Tracking branches • Pulling branches • Removing remote branches Lucas Saldanha® - http://www.lucassaldanha.com 21

Slide 22

Slide 22 text

Rebasing • How it works • When to use • Rebase catches • Rebase vs. Merge Lucas Saldanha® - http://www.lucassaldanha.com 22

Slide 23

Slide 23 text

References • Charco, Scott e Straub, Ben - Git Pro 2ª edição (http://git- scm.com/book/en/v2/) • Git Reference (http://gitref.org/) • Atlassian Git Tutorials (https://www.atlassian.com/git/tutorials/) • Git Documentation (https://git.wiki.kernel.org/index.php/GitDocumentation) • Git – The simple guide (http://rogerdudler.github.io/git-guide/index.html) • Git - Wikipedia article(http://en.wikipedia.org/wiki/Git_(software)) • Git Real – Code Schools (http://gitreal.codeschool.com/) • Three-Way Merging: A Look Under the Hood (http://www.drdobbs.com/tools/three-way-merging-a-look-under-the- hood/240164902) Lucas Saldanha® - http://www.lucassaldanha.com 23