Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Lets git to it


Published on

Introduction to GIT and branching models

Published in: Technology

Lets git to it

  1. 1. Let’s GIT to it! Introduction to git & branching models Yoram Michaeli <> FullStack Developers Israel 14.5.2014 Tikal, Tel-Aviv Hosted by:
  2. 2. Before you GIT it...
  3. 3. What is GIT?
  4. 4. What is GIT? ● GIT is a distributed revision controlled source code management system (DVCS) ● GIT were created, designed and developed by Linus Torvalds (the creator of Linux) for Linux kernel development (See Linus Torvalds in YouTube) ● Official GIT site:
  5. 5. Why use GIT?
  6. 6. Why use GIT?There are many other SCM/SVCS systems out there... ● GIT is fast ● GIT has no need for network connection - for most operations ● GIT is a great merge and branching tool ● GIT is a modern tool ● GIT have a very large install-base ● GIT encourage developers to commit, which results with less data lose
  7. 7. GIT is distributed ● There is no single server – each endpoint contains all the information. ● Usually there is one endpoint that is considered as the central one but this is not a must. ● The common flow: o You clone the central repository and/or sync with its content o You work offline on your private repository o You push your local changes into the central repository
  8. 8. GIT is distributed
  9. 9. GIT is fast ● For most operations you need no network connection ● Network operations are done very fast using modern and validated transfer actions ● GIT uses snapshots of the whole repository instead of the files-and-delta technology ● GIT uses pointers ● GIT is optimized for merge...
  10. 10. GIT is optimized for merge ● GIT is designed for fast and efficient merge ● GIT supports: o Local merge o 2 repositories/endpoints merge o Simultaneously work on the same resource o Merge is usually done locally before pushing it to the remote repository so it is very easy to abort it or revert to the previous status
  11. 11. Things you must consider about GIT?
  12. 12. Things you must consider about GIT ● GIT is not CVS or SVN or any of those tools ● GIT requires much to learn about it ● GIT command line interface (CLI) is the most recommended client for it
  13. 13. GIT concepts overview
  14. 14. SVN vs. GIT
  15. 15. GIT commit representation
  16. 16. GIT repositoryThe multiple commit concept ● Each commit store a pointer to the former (checksum) commit ● The first commit has a null pointer
  17. 17. GIT branchesBasic terms ● branch – a pointer to some commit ● master – the “default” branch ● HEAD – the current branch of the local/remote repository ● origin – the remote repository (usually – the one you have cloned from) ● origin/master – the master branch (pointer) of the origin repository
  18. 18. GIT local work GIT directory where Git stores the metadata and object database for your project Working directory a single checkout of one version of the project on your disk. Staging area (Index) a simple snapshot file in your Git directory, that stores information about what will go into your next commit. Why staging? ● Gives you the ability to control the content of your next commit ● You can reset changes ● You can 'stash' all changes and work on a new task in the same location ● Once you’re done with your code – for committing - you can: o Review the differences between working directory and staging o Review the differences between staging and HEAD
  19. 19. A GIT file life-cycle
  20. 20. GIT basic flow and operations
  21. 21. GIT basic flow The common flow ● You clone the central repository and sync with its content: o git clone <remote repository URL> - cloning the repository o git pull origin master - sync with remote repository ● You work offline on your private repository o git add --all - staging all new and/or removed files o git commit -m “<comment>” - commit changes ● You push your local changes into the central repository o git push origin master
  22. 22. GIT common actions & flow
  23. 23. Other GIT common commands ● git clone – clone a repository into a new copy ● git status – show the status of your local repository ● git log – show commit logs ● git diff - show the differences between anything: states, branches and more ● git branch – perform branch-related actions such as create branch, list branches and more ● git checkout – switch to work on a certain snapshot (branch, hash, tag) ● git merge – merge into current working snapshot ● git cherrypick – merge picked commits from branch to branch
  24. 24. Let’s GIT started ● Install GIT (usually from ● Initial GIT global settings ● git config --global “Bill Gates” ● git config --global ● GIT repository initiate: ● mkdir microsoft ● cd microsoft ● git init or ● GIT clone: ● git clone git@microsoft:acquired-companies/someTool.git
  25. 25. GIT environments
  26. 26. GIT hosting tools and services
  27. 27. GIT cloud-based hosting services
  28. 28. GIT on-premise hosting tools
  29. 29. Detailed guideline for choosing GIT host service
  30. 30. GIT client tools
  31. 31. GIT GUI client tools
  32. 32. GIT workflows (branching models) Based on Atlassian's 'GIT workflows' excellent introduction!
  33. 33. Centralized Workflow If your developers are already comfortable with Subversion, the Centralized Workflow lets you experience the benefits of Git without having to adapt to an entirely new process. It also serves as a friendly transition into more Git-oriented workflows. See more...
  34. 34. Feature Branch Workflow The Feature Branch Workflow builds on the Centralized Workflow by encapsulating new features into dedicated branches. This enables the use of pull requests as a means to discuss changes before they’re integrated into the official project. See more...
  35. 35. Gitflow Workflow The Gitflow Workflow streamlines the release cycle by using isolated branches for feature development, release preparation, and maintenance. Its strict branching model also lends some much needed structure to larger projects. See more...
  36. 36. GitHub Flow what is GitHub Flow? ● Anything in the master branch is deployable ● To work on something new, create a descriptively named branch off of master (ie:new-oauth2-scopes) ● Commit to that branch locally and regularly push your work to the same named branch on the server ● When you need feedback or help, or you think the branch is ready for merging, open a pull request ● After someone else has reviewed and signed off on the feature, you can merge it into master ● Once it is merged and pushed to ‘master’, you can and should deploy immediately See more...
  37. 37. Forking Workflow The Forking Workflow is a distributed workflow that takes full advantage of Git’s branching and cloning capabilities. It provides a safe, reliable way to manage large teams of developers and to accept commits from untrusted contributors. See more...
  38. 38. Pull requests Pull request (sometimes called merge request) is a feature that makes it easier for developers to collaborate using the hosting service. It provides a user- friendly web interface for discussing proposed changes before integrating them into the official project. See more...
  39. 39. GIT more
  40. 40. Other GIT great starting points
  41. 41. Yoram Michaeli Email: Tel: +972-52-5766838 Thank You