• allows to recall specific versions later • allows to revert files back to a previous state ◦ even the entire project can be reverted • provides comparison between distinct states • registers author or authors of the changes version control 3
— keeps patch sets in a special format on disk • centralized ◦ single server contains all versioned files — single point of failure ◦ svn, perforce, cvs • distributed ◦ clients fully mirror entire repository ◦ even when all servers fail, repository can be recovered from client’s copy ◦ allows collaboration with different groups of people ◦ git, mercurial, bazaar version control — types 4
particular, Linus Torvalds, the creator of Linux ◦ Linux kernel project began using a proprietary DVCS called BitKeeper • developed with the following goals: ◦ speed ◦ simple design ◦ strong support for non-linear development ◦ fully distributed ◦ able to handle large projects like the Linux kernel about git 6
snapshots ◦ everytime state is changed and saved, it takes a picture (snapshot) of current files ◦ in new snapshots, it stores a link for previous files that have not changed git — what is 8
information is needed from another computer ◦ history is stored in the local “database” ◦ it calculates locally the difference of multiple versions ◦ every change in files is locally stored • all changes are known ◦ integrity is one of the most important characteristics ◦ it is impossible to change a file without git knowing about it • only adds data ◦ it is very hard to erase data in any way git — what is 9
◦ each commit is identified by a hash code (4c1f6...) • modified ◦ file has changed but those changes are not commited to database yet • staged ◦ marked one or more files to go into next commit git — three states of files 10
of one version of project. pulled from .git database and placed on disk to use or modify Information about what will go into the next commit a single file stores it Metadata and object database for project most important part of a git project
◦ master is a branch that is tipically created by default ◦ HEAD is a pointer (but not a branch) to current active branch ◦ it allows to diverge paths of development git branch — what is 25
conflicts ◦ they appear when the same part of files is changed in both branches <div> content </div> index.html <div> new content </div> index.html master testing
◦ requires human intervention to resolve them ◦ human chooses which one he wants and saves the file ◦ human commits changes and tells git to continue <div> <<<<<<< HEAD:index.html content ============= new content >>>>>>> testing:index.html </div> index.html merge testing into master
[-v] ▪ lists configured remote servers ▪ origin is the most common name of primary server ◦ $ git remote add <name> <url> ▪ adds a remote server to current local repository git — remotes 40