BOOST YOUR DEV TEAM’S SPEED AND PRODUCTIVITY Duy Lam .::. Aug 2013 © 2013 KMS Technology 1
AGENDA © 2013 KMS Technology 2 Git Introduction Branch in Git Remote Git Git Practices
ABOUT ME Software Architect at KMS Technology Vietnam duylam@kms-technology.com http://vn.linkedin.com/in/duylamphuong © 2013 KMS Technology 3 Lâm Phương Duy
WHAT YOU TAKE IN THE END Git Use Git Use Git Effectively Git for advanced needs Git or else? © 2013 KMS Technology 4
AGENDA © 2013 KMS Technology 5 Git Introduction Branch in Git Remote Git Git Practices
VERSION CONTROL SYSTEM TYPES © 2013 KMS Technology 6 Centralized Version Control System Distributed Version Control System
THREE GIT TRAITS #1 COMMITS ARE SNAPSHOT © 2013 KMS Technology 7
THREE GIT TRAITS #2 WORK WITHOUT NETWORK © 2013 KMS Technology 8
THREE GIT TRAITS #3 TWO STATES © 2013 KMS Technology 9 Working Directory Git Repository git add git rm etc. git commit Git Index / Staging Area
BASIC WORKS (DEMO)  Create new git repository  Work on git staging area  Update git repository  Check status  Undo © 2013 KMS Technology 10
AGENDA © 2013 KMS Technology 11 Git Introduction Branch in Git Remote Git Git Practices
BRANCH AND HOW IT WORKS © 2013 KMS Technology 12 1 2 3 4
MERGING BRANCH FAST FORWARD © 2013 KMS Technology 13 git merge hotfix
MERGING BRANCH NON FAST FORWARD © 2013 KMS Technology 14 git merge iss53
AGENDA © 2013 KMS Technology 15 Git Introduction Branch in Git Remote Git Git Practices
REMOTE URLS © 2013 KMS Technology 16 Local /data/git/project.git SSH* user@server:project.git Git git://server/project.git HTTP http://server/project.git (*) Setup authentication: https://help.github.com/articles/generating-ssh-keys
REMOTE BRANCH © 2013 KMS Technology 17 Time
REMOTE TRACKING BRANCH  a local branch associated with remote branch © 2013 KMS Technology 18 > git branch --track [branch] [remote name]/[branch]
UPDATE WITH REMOTE REPOSITORY GET CHANGES #1 © 2013 KMS Technology 19 Time git fetch origin
UPDATE WITH REMOTE REPOSITORY GET CHANGES #2 © 2013 KMS Technology 20 Time git pull origin master origin/master
UPDATE WITH REMOTE REPOSITORY SAVE CHANGES © 2013 KMS Technology 21 masterorigin/master git.ourcompany.com Time master masterorigin/master git push origin
BASIC WORKS (DEMO)  Create remote git repository  Get new commits from remote repository  Save new commits to remote repository © 2013 KMS Technology 22
AGENDA © 2013 KMS Technology 23 Git Introduction Branch in Git Remote Git Git Practices
HIGHLIGHT OF GIT FEATURES (DEMO)  git tag  git stash  git submodule © 2013 KMS Technology 24
GIT CLIENTS  http://git-scm.com: Git CLI (command line interface)  UI clients – TortoiseGit – SmartGit – SourceTree Free – Git Extensions © 2013 KMS Technology 25
GIT OR SVN ? Speed of operation Faster Data loss Less Independent and isolated environment Yes Access control Yes Locking mechanisms Yes Storage space 1/30 size © 2013 KMS Technology 26
GIT PRACTICES  Line-ending issue on platforms  Do not miss any file when committing in conflicted merge © 2013 KMS Technology 27 Windows Mac & Linux Problem rn n Solution git config --global core.autocrlf true git config --global core.autocrlf input
GIT PRACTICES © 2013 KMS Technology 28  Prefer --no-ff option on merging
© 2013 KMS Technology THANK YOU © 2013 KMS Technology 29 Thank You

Git - Boost Your DEV Team Speed and Productivity

  • 1.
    BOOST YOUR DEVTEAM’S SPEED AND PRODUCTIVITY Duy Lam .::. Aug 2013 © 2013 KMS Technology 1
  • 2.
    AGENDA © 2013 KMSTechnology 2 Git Introduction Branch in Git Remote Git Git Practices
  • 3.
    ABOUT ME Software Architect atKMS Technology Vietnam duylam@kms-technology.com http://vn.linkedin.com/in/duylamphuong © 2013 KMS Technology 3 Lâm Phương Duy
  • 4.
    WHAT YOU TAKEIN THE END Git Use Git Use Git Effectively Git for advanced needs Git or else? © 2013 KMS Technology 4
  • 5.
    AGENDA © 2013 KMSTechnology 5 Git Introduction Branch in Git Remote Git Git Practices
  • 6.
    VERSION CONTROL SYSTEMTYPES © 2013 KMS Technology 6 Centralized Version Control System Distributed Version Control System
  • 7.
    THREE GIT TRAITS #1COMMITS ARE SNAPSHOT © 2013 KMS Technology 7
  • 8.
    THREE GIT TRAITS #2WORK WITHOUT NETWORK © 2013 KMS Technology 8
  • 9.
    THREE GIT TRAITS #3TWO STATES © 2013 KMS Technology 9 Working Directory Git Repository git add git rm etc. git commit Git Index / Staging Area
  • 10.
    BASIC WORKS (DEMO)  Createnew git repository  Work on git staging area  Update git repository  Check status  Undo © 2013 KMS Technology 10
  • 11.
    AGENDA © 2013 KMSTechnology 11 Git Introduction Branch in Git Remote Git Git Practices
  • 12.
    BRANCH AND HOWIT WORKS © 2013 KMS Technology 12 1 2 3 4
  • 13.
    MERGING BRANCH FAST FORWARD ©2013 KMS Technology 13 git merge hotfix
  • 14.
    MERGING BRANCH NON FASTFORWARD © 2013 KMS Technology 14 git merge iss53
  • 15.
    AGENDA © 2013 KMSTechnology 15 Git Introduction Branch in Git Remote Git Git Practices
  • 16.
    REMOTE URLS © 2013KMS Technology 16 Local /data/git/project.git SSH* user@server:project.git Git git://server/project.git HTTP http://server/project.git (*) Setup authentication: https://help.github.com/articles/generating-ssh-keys
  • 17.
    REMOTE BRANCH © 2013KMS Technology 17 Time
  • 18.
    REMOTE TRACKING BRANCH a local branch associated with remote branch © 2013 KMS Technology 18 > git branch --track [branch] [remote name]/[branch]
  • 19.
    UPDATE WITH REMOTEREPOSITORY GET CHANGES #1 © 2013 KMS Technology 19 Time git fetch origin
  • 20.
    UPDATE WITH REMOTEREPOSITORY GET CHANGES #2 © 2013 KMS Technology 20 Time git pull origin master origin/master
  • 21.
    UPDATE WITH REMOTEREPOSITORY SAVE CHANGES © 2013 KMS Technology 21 masterorigin/master git.ourcompany.com Time master masterorigin/master git push origin
  • 22.
    BASIC WORKS (DEMO)  Createremote git repository  Get new commits from remote repository  Save new commits to remote repository © 2013 KMS Technology 22
  • 23.
    AGENDA © 2013 KMSTechnology 23 Git Introduction Branch in Git Remote Git Git Practices
  • 24.
    HIGHLIGHT OF GITFEATURES (DEMO)  git tag  git stash  git submodule © 2013 KMS Technology 24
  • 25.
    GIT CLIENTS  http://git-scm.com:Git CLI (command line interface)  UI clients – TortoiseGit – SmartGit – SourceTree Free – Git Extensions © 2013 KMS Technology 25
  • 26.
    GIT OR SVN? Speed of operation Faster Data loss Less Independent and isolated environment Yes Access control Yes Locking mechanisms Yes Storage space 1/30 size © 2013 KMS Technology 26
  • 27.
    GIT PRACTICES  Line-endingissue on platforms  Do not miss any file when committing in conflicted merge © 2013 KMS Technology 27 Windows Mac & Linux Problem rn n Solution git config --global core.autocrlf true git config --global core.autocrlf input
  • 28.
    GIT PRACTICES © 2013KMS Technology 28  Prefer --no-ff option on merging
  • 29.
    © 2013 KMSTechnology THANK YOU © 2013 KMS Technology 29 Thank You

Editor's Notes

  • #8 A commit contains:changes at the time it’s createda pointer to parent commit containing unchanged thingscommit ID is a hex string for hashed content
  • #10 Staging Area ~ temporary storage managed by Git
  • #11 Go through following commands:gitinitgit add, rm, mvgit commitgit commit –amendgit log, status, diffgit reset, checkout (undo + go to commit)
  • #13 Branch ~ pointer to a commitHEAD ~ alias for latest commit in branch
  • #18 remote branch is controlled by git fetch + git pushgit clone by default creates a master remote branch
  • #23 Update configuration to allow pushing: $ gitconfigreceive.denyCurrentBranch ignoregit clonegit fetch (+ pull)git push
  • #27 speed of operation: commit, viewing history, reverting changes, etc.data loss: SVN can have corrupted revision databaseindependent and isolated: Git allows user to work without network connection and keep their work privatelylock mechanims: plays an important role when it comes to non-mergable binary files such as graphic assetsaccess control: define read/write permission on particular folder, allow to work on particular folder instead of getting entire tree
  • #28 Line-ending issueWindows: convert CRLF to LF when commit, and convert LF to CRLF when checkout to file systemLinux: convert CRLF to LF when commit onlyDo not miss: if you miss any file, it means changes in that files from the branch you’re merging will be discarded