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

Git

Avatar for Marcin Dryka Marcin Dryka
February 05, 2013

 Git

Git basics

Avatar for Marcin Dryka

Marcin Dryka

February 05, 2013
Tweet

More Decks by Marcin Dryka

Other Decks in Technology

Transcript

  1. !"# Centralne VCS Server Version 1 Version 2 Version 3

    Computer 1 Computer 2 poniedziałek, 4 lutego 2013
  2. !"# Zalety • wiadomo kto nad czym pracuje • kontrola

    administracyjna poniedziałek, 4 lutego 2013
  3. !"# Rozproszone VCS Computer 2 Version 1 Version 2 Version

    3 Computer 1 Version 1 Version 2 Version 3 poniedziałek, 4 lutego 2013
  4. !"# Cele projektu Git • szybkie działanie • prostota architektury

    • wsparcie dla tysięcy równoległych repozytoriów • pełne rozproszenie • utrzymanie ogromnych projektów (GNU/Linux kernel), zarówno pod względem szybkości działania jak i rozmiaru danych poniedziałek, 4 lutego 2013
  5. !"# SVN Version 1 Version 2 Version 3 Version 4

    Version 5 File A File B File C Δ 1 Δ 1 Δ 2 Δ 3 Δ 3 Δ 4 poniedziałek, 4 lutego 2013
  6. !"# GIT Version 1 Version 2 Version 3 Version 4

    Version 5 File A File B File C File A1 File A2 File B1 File C1 File C2 File C3 File A1 File A2 File B File B File B1 File C2 poniedziałek, 4 lutego 2013
  7. !"# Pierwsze spotkanie z Git git config --global user.name "Marcin

    Dryka" git config --global user.email [email protected] bash <(curl -s https://raw.github.com/drymek/git-config/ master/setup.sh) lub poniedziałek, 4 lutego 2013
  8. !"# (Prawie) wszystkie operacje są lokalne • historia commitów •

    diff pomiędzy wersjami • log zmian • poprzednie rewizje poniedziałek, 4 lutego 2013
  9. !"# Tworzenie repozytorium git init git add *.php git add

    README git commit -m 'message' git clone [email protected]:drymek/symfony-standard.git symfony lub poniedziałek, 4 lutego 2013
  10. !"# Cykl życia statusu unmodified modified staged add the file

    untracked edit the file stage the file commit remove the file poniedziałek, 4 lutego 2013
  11. !"# Polecenia git status git diff git checkout -- git

    add git reset HEAD (unstage) git commit git rm git mv poniedziałek, 4 lutego 2013
  12. !"# Ignorowanie plików • *.[oa] • *~ • katalog/ •

    !pattern vim .gitignore poniedziałek, 4 lutego 2013
  13. !"# Zapomniany plik git commit -m 'initial commit' git add

    forgotten_file git commit --amend poniedziałek, 4 lutego 2013
  14. !"# Remotes git remote -v origin [email protected]:drymek/symfony-standard.git (fetch) origin [email protected]:drymek/symfony-standard.git

    (push) git remote add origin [email protected]:drymek/symfony- standard.git git remote rm origin git remote rename origin github poniedziałek, 4 lutego 2013
  15. !"# Branches git branch -v # wypisanie branchy git branch

    testing # stworzenie brancha git checkout testing # przełączenie na branch # (...) zmiany git checkout master # przełączenie na master, brak zmian git merge testing # połączenie zmian git branch -d testing # usunięcie brancha git checkout -b testing lub poniedziałek, 4 lutego 2013
  16. !"# pull & push git pull origin master git push

    origin master poniedziałek, 4 lutego 2013
  17. !"# Konflikty git merge testing Auto-merging index.html CONFLICT (content): Merge

    conflict in index.html Automatic merge failed; fix conflicts and then commit the result. git mergetool merge tool candidates: kdiff3 tkdiff xxdiff meld gvimdiff opendiff emerge vimdiff tortoisemerge poniedziałek, 4 lutego 2013
  18. !"# stash git stash list git stash git stash pop

    git stash drop poniedziałek, 4 lutego 2013