Git

Embed Size (px)

Citation preview

  • 1. Git DVCS Ladislav Prskavec [email_address]

2. Obsah

  • Zklady systmu Git

3. Instalace 4. Nastaven systmu 5. Zskn reposite 6. Nahrvn zmn do reposite 7. Zobrazen historie zmn 8. een zmn 9. Prce se vzdlenmi repoziti 10. Znaky (tagy) 11. Vtve 12. Git na serveru 13. Distribuovan pracovn postupy 14. Nstroje systmu Git 15. Zklady systmu Git

  • Snmky nikoliv rozdly

16. Tm kad operace je lokln 17. Zklady systmu Git 2

  • Git pracuje dsledn sha1

18. Struktura commitu 19. Zklady systmu Git 3

  • Ti stavy

20.

  • Instalace
  • Linux
  • apt-get install git-core

21. yum install git-core Windows

  • msysgit

22.

  • Nastaven systmu

# usergit config --global user.name "Ladislav Prskavec" git config --global user.email [email protected] # barvy git config --global color.diff auto git config --global color.status auto git config --global color.branch auto 23.

  • Nastaven systmu 2

~/.gitconfig [alias] st = status ci = commit -s br = branch co = checkout vis = !gitk --all & cat ~/bin/dotfiles/bash/aliases | grep git alias ungit="find . -name '.git' -exec rm -rf {} ;" alias gl='git reset --hard && git pull' alias gp='git push' alias g='git status' 24.

  • Zskn reposite
  • Inicializace v exitujcm adresi
  • git init

25. git add . 26. git commit -m 'Initial commit' Klonovn existujcho reposite

  • git clone git://git.kernel.org/pub/scm/git/git.git

27. git clone git://git.kernel.org/pub/scm/git/git.git mygit 28.

  • Nahrvn zmn do reposite
  • git status

29.

  • Nahrvn zmn do reposite 2
  • Ignorovan soubory - .gitignore
  • blob syntaxe, adrese kon /

30. Negace ! Zmny

  • git diff

31. git diff cached Zpis zmn

  • git commit

Odstann soubor

  • rm

32. git rm 33. git rm cached Pesun soubor

  • git mv

34.

  • Zobrazen historie zmn
  • git log

35. git log -p 36. git log stats 37. git shortlog 38. git log oneline 39. git log pretty=format:%h - %an, %ar : s 40. git log --pretty=format:'%an%ai%s%n%b' 41.

  • Zobrazen historie zmn 2
  • gitk

42. tig 43.

  • een zmn
  • Zmna posledn revize
  • git commit amend

Nvrat z oblasti zmn

  • git reset HEAD file

Ruen zmn v souborech

  • git checkout file

44. POZOR! nebezpen pkaz 45. obdoba svn revert 46.

  • Prce se vzdlenmi repoziti
  • git clone git://git.kernel.org/pub/scm/git/git.git

47. git remote -v

  • origin git://git.kernel.org/pub/scm/git/git.git (fetch)

48. origin git://git.kernel.org/pub/scm/git/git.git (push) git remote 49. Pidvn vzdlenho reposite

  • git remote add neco git://git.kernel2.org/...

Nahrvn zmn ze vzdlenho reposite

  • git fetch neco

50.

  • Prce se vzdlenmi repoziti 2

51.

  • Prce se vzdlenmi repoziti 3
  • Nahrvn zmn do vzdlenho reposite
  • git push origin master

Prohlen vzdlench reposit

  • git remote show origin

Pesouvn a pejmenovn

  • git remote rename pb paul

52. git remote rm paul 53.

  • Znaky (tagy)
  • Seznam tag
  • git tag

Informace o konkrtnm tagu

  • git tag -v 'v1.7.0-rc0'

Vytven anotovan zanky

  • git tag -a v1.8 -m 'my version 1.8'

54. git tag -a v1.2 9fceb02 Informace o znace a revizi zobrazme

  • git show v1.7.0-rc0

Znaky se daj podepsat GPG (-s) 55. Vytvoen prost znaky

  • git tag v1.9

56.

  • Znaky (tagy) 2
  • Znaky se nepenej na server automaticky
  • git push origin v1.5

Nebo mete penst vechny

  • git push origin --tags

57.

  • Vtve
  • Informace o vtvch
  • git branch

58. git branch -a Zmna vtve

  • gitcheckout testing

Merge

  • git checkout master

59. git merge testing 60. Vtve 2

  • Vytvoen vtve
  • git checkout -b bug111

61. Zkrcen tento zpis

  • git branch bug111

62. git checkout bug111 Merge

  • git mergetool

63. Zkladn merge

  • git checkout master

64. git merge bug git branch merged, git branch no-merged 65. git cherry-pick SHA1_HASH Mazn vtve

  • git branch -d bug111

66.

  • Git na serveru
  • Webov rozhran
  • Gitweb

Sprva prv

  • Gitosis

67. Gitolite Veejn pstup

  • Dmon Git

Hostovn Gitu

  • Github.com

68.

  • Distribuovan pracovn postupy
  • Centralized

69.

  • Distribuovan pracovn postupy 2
  • Integration manager

70.

  • Distribuovan pracovn postupy 3
  • Dictator and Lieutenants

71.

  • Nstroje systmu Git
  • git add -i

72. git stash 73. git rebase -i 74. git filter-branch 75. git blame 76. git bisect 77. git submodule 78. git apply 79. git am 80. Dkuji za pozornost Otzky? 81. Git a SVN

  • git svn clone
  • svn checkout

git svn dcommit

  • svn commit

git svn rebase

  • svn update

82. Converting a Subversion repository to Git

  • mkdir /path/to/exampleapp-git.tmp

83. cd /path/to/exampleapp-git.tmp 84. git-svn init file:///u/repos/exampleapp --no-metadata --trunk=trunk --branches=branches --tags=tags 85. git config svn.authorsFile /path/to/authors.txt 86. git-svn fetch