Version Control Systems: Git
Embed Size (px)
Transcript of Version Control Systems: Git
Version Control Systems: Git
, . , 2012
Version Control System (version control system VCS revision control system)
Version Control System VCS:- Backup ( ) Save As.. , . ( ..) ( , , ) directory ..!
Version Control System VCS: log ,
Version Control SystemIn a VCS: Files cannot be overwritten There is a common repository that holds all the latest files Allows you to revert back to an older version of the file/project if needed Allows you to inspect differences (diff) between versions
Version Control System VCS:
Suppose Alice modifies class A, and Bob modifies class B. They both upload their changes. Most systems will automatically deduce a reasonable course of action: accept and merge their changes, so both Alices and Bobs edits are applied.
Now suppose both Alice and Bob have made distinct edits to the same line. Then it is impossible to proceed without human intervention. The second person to upload is informed of a merge conflict, and must choose one edit over another, or revise the line entirely.
More complex situations can arise. Version control systems handle the simpler cases themselves, and leave the difficult cases for humans.
Git Git (distributed version control system DVCS) . (push) .
Centralized vs. Distributedeach action has to pass through the network leaving a developer unable to work if they happen to have no network connection
Centralized vs. DistributedIn distributed systems, each developer has their own full-fledged repository on their computer. In most set-ups theres an additional central repository on a server thats used for sharing. However, this is not a requirement; every developer can perform all important actions in their local repository: committing changes, viewing differences between revisions, switching branches, etc
Git Git is an open source project, that has been active for several years and is written mostly in C
Git Eclipse usage: Project & code repository breakdown as of 2012-03-25
Git popularity Google Trends (blue: Git, red: svn)
GitOperations (with remote)
Git WorkflowSubversion-Style WorkflowA centralized workflow is very common, especially from people transitioning from a centralized system. Git will not allow you to push if someone has pushed since the last time you fetched, so a centralized model where all developers push to the same server works just fine.
Git WorkflowIntegration Manager: single person who commits to the blessed repository
Git WorkflowDictator and Lieutenants WorkflowFor more massive projects, a development workflow like that of the Linux kernel is often effective. In this model, some people ('lieutenants') are in charge of a specific subsystem of the project and they merge in all changes related to that subsystem. Another integrator (the 'dictator') can pull changes from only his/her lieutenants and then push to the 'blessed' repository that everyone then clones from again.
Prerequisites Install EGit Create a project in a remote repository (e.g. GitHub) Put project under version control
Basic Usageretrieved from Git the basics, B. Trojanowski, 2008
Branching #53 (branch)
Branching ( ) commit. iss53 .
Branching . #53 master. , working directory
Branching (hotfix) commit.
Branching (merge) hotfix master. (fast-forward) hotfix master. merge
Branching O hotfix (switch to) iss53. commit
Branching #53 , master branch (three-way merge)
Branching conflicts :
BranchingConflicts . O conflict add merging
Reading Stuff Git with Eclipse (EGit) Tutorial: http://www.vogella.com/articles/EGit/article.html EGit tutorial: http://unicase.blogspot.gr/2011/01/egit-tutorial-for-beginners.html
Top 10 Git Tutorials: http://sixrevisions.com/resources/git-tutorials-beginners/
Pro Git Book: http://git-scm.com/book