Version Control with Git

  • 1,108 views
Uploaded on

Introduction to Git. Also discusses how you can use Git with Subversion, in case you cannot migrate your subversion just yet.

Introduction to Git. Also discusses how you can use Git with Subversion, in case you cannot migrate your subversion just yet.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,108
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
41
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Versiebeheer met Git Andrej Koelewijn, IT-eye Jfall 2009, 11 november 2009
  • 2. Eenvoudig, tooling
  • 3. Single point of control
  • 4. Security
  • 5. Subversion is NICE!!!
  • 6. Mergen kan beter...
  • 7. Iteratie stabiel afronden...
  • 8. Iteratie stabiel afronden...
  • 9. Telewerken lijkt onvermijderlijk...
  • 10. SVN Repo thuis niet beschikbaar...
  • 11. Onderhouden fork lastig...
  • 12. Lost Git al deze problemen op?
  • 13. Why: Linus ● Linus basically applies patches all day
  • 14. Gedistribueerd
  • 15. Gedistribueerd 3-way merge
  • 16. Gedistribueerd 3-way merge Snel
  • 17. Gedistribueerd 3-way merge Snel Efficient
  • 18. $ mkdir proj $ cd proj $ git init Initialized empty Git repository in /home/akoelewijn/projects/git-demo/proj/.git/ $ vi readme.txt $ git add . $ git commit -m "Added readme" [master (root-commit) 339bb9e] Added readme 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 readme.txt $ git log commit 339bb9e5417ae66f755ca49f64a9eba61cec1e46 Author: Andrej Koelewijn <andrej@koelewijn.net> Date: Fri Nov 6 15:10:38 2009 +0100 Added readme $
  • 19. $ git branch * master $ git checkout -b feature1 Switched to a new branch 'feature1' $ vi HelloWorld.gr $ git add . $ git commit -m "Added hello world script" [feature1 de8e8a1] Added hello world script 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 HelloWorld.gr $ git checkout master Switched to branch 'master' $ vi readme.txt $ git commit -am "Added some text to readme" [master e5d4f53] Added some text to readme 1 files changed, 1 insertions(+), 0 deletions(-) $ git merge feature1 Merge made by recursive. HelloWorld.gr | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 HelloWorld.gr
  • 20. $ git log --pretty=oneline –graph * 9fe15c09afcf5d9c5699cc721f17905a7a0aa2e6 Merge branch 'feature1' | | * de8e8a1fd33c37257d3d9843d1844c613d576819 Added hello world script * | e5d4f530feef98ca66ef96a0fdd5efab377610fa Added some text to readme |/ * 339bb9e5417ae66f755ca49f64a9eba61cec1e46 Added readme
  • 21. $ git log --pretty=oneline –graph * 9fe15c09afcf5d9c5699cc721f17905a7a0aa2e6 Merge branch 'feature1' | | * de8e8a1fd33c37257d3d9843d1844c613d576819 Added hello world script * | e5d4f530feef98ca66ef96a0fdd5efab377610fa Added some text to readme |/ * 339bb9e5417ae66f755ca49f64a9eba61cec1e46 Added readme
  • 22. $ git log --pretty=oneline --graph * 3387f004f910bf28f0d7da3ca0e6943b780f3549 Added info to readme * 2d7effcac27a54688ea6a26fb849730ccdb8578a Added readme file $ git branch feature1 * master $ git checkout feature1 Switched to branch 'feature1' $ git log --pretty=oneline --graph * 7c5f57666847452b4b54dc7731ce0e8efd4e2ffc Added helloworld file * 2d7effcac27a54688ea6a26fb849730ccdb8578a Added readme file $ git rebase master First, rewinding head to replay your work on top of it... Applying: Added helloworld file
  • 23. $ git checkout master Switched to branch 'master' $ git merge feature1 Updating 3387f00..c51aef2 Fast forward HelloWorld.gr | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) create mode 100644 HelloWorld.gr $ git log --pretty=oneline --graph * c51aef26645fbee96b5365caea656d9417c84a5d Added helloworld file * 3387f004f910bf28f0d7da3ca0e6943b780f3549 Added info to readme * 2d7effcac27a54688ea6a26fb849730ccdb8578a Added readme file
  • 24. Onder de motorkap...
  • 25. 6ff87c4664981e4397625791c8ea3bbb5f2279a3
  • 26. Git objecten
  • 27. Commit = snapshot
  • 28. Commit history = Directed graph
  • 29. $ git init Initialized empty Git repository in /home/akoelewijn/projects/git- demo/usr1/proj1/.git/ $ vi readme.txt $ git add . $ git commit -m "First commit" [master (root-commit) 8d0a113] First commit 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 readme.txt $ git clone file:///home/akoelewijn/projects/git-demo/usr1/proj1/ Initialized empty Git repository in /home/akoelewijn/projects/git- demo/usr2/proj1/.git/ remote: Counting objects: 3, done. remote: Total 3 (delta 0), reused 0 (delta 0) Receiving objects: 100% (3/3), done. $ git log commit 8d0a1131b202e9ddc34161f6b57f9e96702c6fc0 Author: Andrej Koelewijn <andrej@koelewijn.net> Date: Sun Nov 8 13:39:57 2009 +0100 First commit
  • 30. $ vi HelloWorld.gr $ git add HelloWorld.gr $ git commit -m "Added hello world script" [master b8c72a9] Added hello world script 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 HelloWorld.gr $ git pull remote: Counting objects: 4, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From file:///home/akoelewijn/projects/git-demo/usr1/proj1 8d0a113..b8c72a9 master -> origin/master Updating 8d0a113..b8c72a9 Fast forward HelloWorld.gr | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 HelloWorld.gr $ $ git log --pretty=oneline --graph * b8c72a91edc1f19578dd48c18e02c2025a8dd681 Added hello world script * 8d0a1131b202e9ddc34161f6b57f9e96702c6fc0 First commit
  • 31. .git/config: [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = file:///home/akoelewijn/projects/git-demo/usr1/proj1/ [branch "master"] remote = origin merge = refs/heads/master
  • 32. $ git svn clone file:///home/akoelewijn/projects/svngit-demo1/svn.repo/repo1/ Initialized empty Git repository in /home/akoelewijn/projects/git- demo/repo1/.git/ A trunk/proj1/readme.txt W: +empty_dir: branches W: +empty_dir: tags r1 = bf4e7734d6c9669a07bfbf05aa95e4033946e572 (git-svn) M trunk/proj1/readme.txt r2 = 7bee0ad4161eb4af856445f618687221e41e4c54 (git-svn) Checked out HEAD: file:///home/akoelewijn/projects/svngit-demo1/svn.repo/repo1 r2 $ cd repo1 $ vi trunk/proj1/readme.txt $ git add . $ git commit -m "A change from git" [master c1866ef] A change from git 1 files changed, 1 insertions(+), 0 deletions(-) $ git svn rebase Current branch master is up to date. $ git svn dcommit Committing to file:///home/akoelewijn/projects/svngit-demo1/svn.repo/repo1 ... M trunk/proj1/readme.txt Committed r3 M trunk/proj1/readme.txt r3 = b636e7fac235e2c0a60995c63aae17f23f3b31a7 (git-svn) No changes between current HEAD and refs/remotes/git-svn Resetting to the latest refs/remotes/git-svn
  • 33. $ git svn log ------------------------------------------------------------------------ r3 | akoelewijn | 2009-11-08 21:15:37 +0100 (Sun, 08 Nov 2009) | 2 lines A change from git ------------------------------------------------------------------------ r2 | akoelewijn | 2009-09-24 13:00:08 +0200 (Thu, 24 Sep 2009) | 2 lines First changes ------------------------------------------------------------------------ r1 | akoelewijn | 2009-09-24 12:38:16 +0200 (Thu, 24 Sep 2009) | 2 lines Initial import
  • 34. $ git log commit b636e7fac235e2c0a60995c63aae17f23f3b31a7 Author: akoelewijn <akoelewijn@be08ebd2-3bba-4eed-b74f-8e2b0cfc31d3> Date: Sun Nov 8 20:15:37 2009 +0000 A change from git git-svn-id: file:///home/akoelewijn/projects/svngit-demo1/svn.repo/repo1@3 be08ebd2-3bba-4eed-b74f-8e2b0cfc31d3 commit 7bee0ad4161eb4af856445f618687221e41e4c54 Author: akoelewijn <akoelewijn@be08ebd2-3bba-4eed-b74f-8e2b0cfc31d3> Date: Thu Sep 24 11:00:08 2009 +0000 First changes git-svn-id: file:///home/akoelewijn/projects/svngit-demo1/svn.repo/repo1@2 be08ebd2-3bba-4eed-b74f-8e2b0cfc31d3 commit bf4e7734d6c9669a07bfbf05aa95e4033946e572 Author: akoelewijn <akoelewijn@be08ebd2-3bba-4eed-b74f-8e2b0cfc31d3> Date: Thu Sep 24 10:38:16 2009 +0000 Initial import git-svn-id: file:///home/akoelewijn/projects/svngit-demo1/svn.repo/repo1@1 be08ebd2-3bba-4eed-b74f-8e2b0cfc31d3
  • 35. Lost Git al deze problemen op?
  • 36. SVN Repo thuis niet beschikbaar...
  • 37. Onderhouden fork lastig...
  • 38. Beter door snapshots
  • 39. Nadeel – clonen svn repo traag
  • 40. Betere tool dan SVN ● Git een goede aanvulling op SVN ● Gedistribueerd werken nuttig voor ● multi-team development Goede tool voor integratie ● managers
  • 41. http://www.it-eye.nl/ andrej.koelewijn@it-eye.nl http://www.andrejkoelewijn.com/