Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git crash course for centralised VCS users

Git crash course for centralised VCS users

In this talk, I introduce Git and its distributed VCS concepts in a way that it is easy for centralized VCS users (CVS, SVN, etc.). We'll talk about the differences between centralized and distributed VCS and you'll learn all the basics concepts that you ned to start using Git with confidence. This talk is supposed to be done together with hands-on laboratory.

Lucas Saldanha

February 02, 2015
Tweet

More Decks by Lucas Saldanha

Other Decks in Programming

Transcript

  1. Git crash course A Git crash course for centralized VCS

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

    First Steps Lucas Saldanha® - http://www.lucassaldanha.com 2
  3. 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
  4. 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
  5. Basic concepts • Deltas vs. Snapshots • Git areas •

    File state Lucas Saldanha® - http://www.lucassaldanha.com 5
  6. 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
  7. 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
  8. 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
  9. Your first repository • Creating a local repository • Cloning

    a remote repository • Ignoring files Lucas Saldanha® - http://www.lucassaldanha.com 13
  10. Working with your repository • Checking files status • Adding

    files • Staging • Commiting • Removing files Lucas Saldanha® - http://www.lucassaldanha.com 14
  11. 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
  12. Undoing things • “Fixing” a commit • Unstaging • Rollback

    changes Lucas Saldanha® - http://www.lucassaldanha.com 16
  13. Remote repositories • List • Add • Fetch • Pull

    • Push Lucas Saldanha® - http://www.lucassaldanha.com 17
  14. Branches • Hot it works • Creating a branch •

    Switching between branches • Removing a branch Lucas Saldanha® - http://www.lucassaldanha.com 18
  15. Tags • Tags types • Lightweight • Annotated • Signed

    • Listing • Creating Lucas Saldanha® - http://www.lucassaldanha.com 19
  16. Merging • Fast forward • Merging without conflicts • Merging

    with conflicts Lucas Saldanha® - http://www.lucassaldanha.com 20
  17. Remote branches • Pushing branches to a remote server •

    Tracking branches • Pulling branches • Removing remote branches Lucas Saldanha® - http://www.lucassaldanha.com 21
  18. Rebasing • How it works • When to use •

    Rebase catches • Rebase vs. Merge Lucas Saldanha® - http://www.lucassaldanha.com 22
  19. 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