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.

Version controll.pptx

326 views

Published on

  • Be the first to comment

  • Be the first to like this

Version controll.pptx

  1. 1. VERSION CONTROL SYSTEM, GIT, BITBUCKET MD. MAIN UDDIN RONY Software Engineer, Infolytx, Inc.
  2. 2. IDEA BEHIND VERSION CONTROL ❑ Different releases of a product ❑ Variations for different platforms • Hardware and software ❑ Versions within a development cycle • Test release with debugging code • Alpha, beta of final release ❑ Each time we may edit a program on recommendation or fixing bugs
  3. 3. VERSION CONTROL ❑ Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. ❑ In particular, allows • old versions to be recovered • multiple versions to exist simultaneously
  4. 4. WHY USE VERSION CONTROL? ❑ Because everyone does • A basic software development tool ❑ Because it is useful • We will want old/multiple versions • Without version control, can’t recreate project history ❑ Because we require it • For our own good • It allows you to revert files back to a previous state • If we screw things up or lose files, we can easily recover
  5. 5. VARIOUS VERSION CONTROL SYSTEMS
  6. 6. LOCAL VERSION CONTROL SYSTEMS
  7. 7. CENTRALIZED VERSION CONTROL SYSTEM
  8. 8. DISTRIBUTED VERSION CONTROL SYSTEMS
  9. 9. GIT : WHAT, WHY? ❑ Distributed revision control system ❑ Originally developed by Linus Torvalds for the development of the Linux Kernel in 2005 ❑ Focus on speed and efficiency ❑ Guard against data corruption, never lose data without intervention ❑ Strong support for non-linear development (thousands of parallel branches) ❑ Able to handle large projects like the Linux kernel efficiently(speed and data size) ❑ Simple design
  10. 10. GIT OVER OTHER VCS ❑ The major difference between Git and any other VCS is the way Git thinks about its data. ❑ Conceptually, most other systems store information as a list of file-based changes. ❑ They think of the information they keep as a set of files and the changes made to each file over time. ❑ But, Git thinks about its data more like a stream of snapshots. ❑ Every time we commit, or save the state of our project in Git, it basically takes a picture of what all our files look like at that moment and stores a reference to that snapshot. ❑ To be efficient, if files have not changed, Git doesn’t store the file again, just a link to the previous identical file it has already stored.
  11. 11. GIT OVER OTHER VCS (CONTD.) Other VCS GIT
  12. 12. GIT OBJECT MODEL A “blob” is content under version control (a file) (Binary Large Object)
  13. 13. GIT OBJECT MODEL (CONTD.) We can have trees of blobs which means directories of files.
  14. 14. GIT OBJECT MODEL (CONTD.) A “commit” is a tree of blobs (a set of changes)
  15. 15. GIT OBJECT MODEL (CONTD.) Most commits modify (or merge) earlier commits.
  16. 16. GIT OBJECT MODEL (CONTD.) We can “tag” an interesting commit
  17. 17. GIT OBJECT MODEL (CONTD.) A graph of commits may belong to a branch.
  18. 18. GIT OBJECT MODEL (CONTD.) “HEAD” is the current branch
  19. 19. GIT OBJECT MODEL (CONTD.) Let’s focus on commits and branches
  20. 20. GIT BASICS
  21. 21. CREATE A GIT REPO ❑ If we’re starting to track an existing project in Git, we need to go to the project’s directory and type ‘git init’ ❑ This creates a new subdirectory named .git that contains all of your necessary repository files – a Git repository skeleton
  22. 22. CLONING AN EXISTING REPOSITORY For example, if you want to clone the Git linkable library called libgit2, you can do so like this: If you want to clone the repository into a directory named something other than “libgit2”, you can specify that as the next command-line option: git clone [url]]
  23. 23. TO TELL GIT TO “STAGE” CHANGES
  24. 24. COMMIT OUR CHANGES
  25. 25. THE FLOW IS
  26. 26. LIFECYCLE OF THE STATUS OF FILES IN GIT
  27. 27. CHECKING THE STATUS OF FILES Suppose we add a new file in our project (a README file)
  28. 28. TRACKING NEW FILES Then run again status checking command
  29. 29. STAGING MODIFIED FILES Let’s change a file that was already tracked. If we change a previously tracked file called “CONTRIBUTING.md” and then run our git status command again, we get something that looks like this:
  30. 30. STAGE THE MODIFIED FILE Let’s run git add now to stage the “CONTRIBUTING.md” file, and then run git status again:
  31. 31. COLLABORATING
  32. 32. BASIC BRANCHING AND MERGING
  33. 33. A simple Commit History
  34. 34. Creating a new branch pointer
  35. 35. The iss53 branch has moved forward with our work
  36. 36. Hotfix branch based on master
  37. 37. master is fast-forwarded to hotfix after merging hotfix with master
  38. 38. Work continues on iss53
  39. 39. Three snapshots used in a typical merge
  40. 40. A merge commit
  41. 41. MERGE CONFLICT
  42. 42. CONFLICT & RESOLVE
  43. 43. BASIC GIT COMMANDS
  44. 44. Git task Notes Git Commands Tell Git who you are Configure the author name and email address to be used with your commits. Note that Git strips some characters (for example trailing periods) from user.name. git config --global user.name "Sam Smith“ git config -- global user.email sam@example.com Create a new local Repository git init Checkout a repository Create a working copy of a local repository: git clone /path/to/repository For a remote server, use: git clone username@host:/path/ to/repository
  45. 45. Git Task Notes Git Commands Add Files Add one or more files to staging (index): git add <filename> git add * Commit Commit changes to head (but not yet to the remote repository): git commit -m "Commit message" Commit any files you've added with git add, and also commit any files you've changed since then: git commit -a Push Send changes to the master branch of your remote repository: git push origin master Status List the files you've changed and those you still need to add or commit: git status
  46. 46. Git Task Ntes Git Commands Connect to a remote repository If you haven't connected your local repository to a remote server, add the server to be able to push to it: git remote add origin <server> List all currently configured remote repositories: List all currently configured remote repositories: Branches Create a new branch and switch to it: git checkout -b <branchname> Switch from one branch to another: git checkout <branchname> List all the branches in your repo, and also tell you what branch you're currently in: git branch Delete the feature branch: git branch -d <branchname> Push the branch to your remote repository, so others can use it: git push origin <branchname> Push all branches to your remote repository: git push --all origin Delete a branch on your remote repository: git push origin :<branchname>
  47. 47. Git Task Notes Git Commands Update from the remote repository Fetch and merge changes on the remote server to your working directory: git pull To merge a different branch into your active branch: git merge <branchname> View all the merge conflicts: View the conflicts against the base file: Preview changes, before merging: git diff git diff --base <filename> git diff <sourcebranch> <targetbranch> After you have manually resolved any conflicts, you mark the changed file: git add <filename> Undo Local changes If you mess up, you can replace the changes in your working tree with the last content in head: Changes already added to the index, as well as new files, will be kept. git checkout -- <filename> Instead, to drop all your local changes and commits, fetch the latest history from the server and point your local master branch at it, do this: git fetch origin git reset --hard origin/master
  48. 48. BITBUCKET
  49. 49. WHAT IS IT? ❑ BitBucket is a web-based code server and also a great management tool for software projects. ❑ On 29 September 2010, Bitbucket was acquired by VC- funded Atlassian. Initially, Bitbucket only offered hosting support for Mercurial projects. On 3 October 2011, Bitbucket officially announced support for Git hosting.
  50. 50. WHY SHOULD WE USE IT? ❑ Bitbucket is completely free if you have a .edu email address. ❑ Gives any one any number of repositories, free for only 5 users, otherwise see the payment on their site. ❑ Site: https://bitbucket.org
  51. 51. CREATING REPOSITORY 21 June 2015
  52. 52. REPOSITORY PAGE oNotice these buttons in the right. oSimple design that gives you only what you want from a code hosting, no noisy design. oNotice the menu ( overview, source, commits, pull requests, issues, wiki, downloads) ▪ This menu has the most important functionality that bitbucket provide for us. ▪ In the right of the menu is the settings of repository 21 June 2015
  53. 53. Bitbucket integration with Eclipse Here is a video demonstrating how Bitbucket can be integrated with Eclipse:
  54. 54. REFERENCE Many context, pictures are borrowed from https://git-scm.com/ 21 June 2015
  55. 55. ANY QUESTION?
  56. 56. THANK YOU

×