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

Introduction to Git

Introduction to Git

A short introduction to Git, created with one of the Rails Girls events in mind.

It goes through the basic workflow:
1) Cloning the repository (git clone).
2) Working on files.
3) What's the situation? (git status)
4) What exactly have I done? (git diff)
5) I want to share these changes (git add)
6) Double-checking (git diff --cached)
7) Making a commit (git commit)
8) Sharing your changes (git push)

Lukasz Wrobel

May 25, 2014
Tweet

More Decks by Lukasz Wrobel

Other Decks in Programming

Transcript

  1. Introduction to Git Łukasz Wróbel

  2. About me • Architect, team leader; • high-traffic websites: ◦

    nk.pl; ◦ Gadu-Gadu. • “Memoirs of a Software Team Leader”; • @lukaszwrobel
  3. Team collaboration

  4. How to introduce changes?

  5. A designated computer? A server? USB flash drive?

  6. Version control Git

  7. Repository Common version. Conflict detection.

  8. A plethora of possibilities Branches - isolation. Master is the

    default one.
  9. Feature branches “Make this button more shiny”. Features being merged

    with master.
  10. 8 steps to collaboration

  11. 1. Cloning the repository » git clone URL

  12. 2. Working on files » vim README.md

  13. 3. What’s the situation? » git status

  14. 3. What’s the situation? » git status # On branch

    master # Changes not staged for commit: # (use "git add <file>..." to update what # will be committed) # (use "git checkout -- <file>..." to # discard changes in working directory) # # modified: README.md # no changes added to commit (use "git add" and/or "git commit -a")
  15. 4. What exactly have I done? » git diff +Some

    important info belongs here. +
  16. 5. I want to share these changes. » git add

    README.md
  17. 6. Double-checking » git diff --cached +Some important info belongs

    here. +
  18. 7. Making a commit » git commit -m 'README extended

    with some vital information'
  19. 7. Making a commit » git commit -m 'README extended

    with some vital information' [master 2964374] README extended with some vital information 1 file changed, 2 insertions(+)
  20. 8. Sharing your changes » git push origin master

  21. How to update your copy? You’re not alone after all.

  22. » git pull origin master

  23. It’s just the beginning.

  24. Thank you! @lukaszwrobel