Git&subversion

17
GIT & SUBVERSION Anonymous

Transcript of Git&subversion

GIT&

SUBVERSIONAnonymous

WORKING ALONE▪ Had code that worked, made a bunch of changes and saved it, which

broke the code, and now you just want the working version back…

▪ Accidentally deleted a critical file, hundreds of lines of code gone…

▪ Somehow messed up the structure/contents of your code base, and want to just “undo” the crazy action you just did

▪ Hard drive crash!!!! Everything’s gone, the day before deadline.

2

WORKING IN TEAMS▪ Whose computer stores the "official" copy of the project?

▪ Will we be able to read/write each other's changes?

▪ Do we have the right file permissions?

▪ Lets just email changed files back and forth.

▪ What happens if we both try to edit the same file?

▪ Kareem just overwrote a file I worked on for 6 hours!

▪ What happens if we make a mistake and corrupt an important file?

▪ Is there a way to keep backups of our project files?

▪ How do I know what code each teammate is working on?

3

SO WHAT CAN I DO?

4

VERSION CONTROL SYSTEM ▪ version control system (often called a source code control system)

does these things:▪ tracks incremental versions (or revisions) of files and, in some cases,

directories over time.

▪ allows you to explore the changes which resulted in each of those versions

▪ Allows “check in” and “check out” of files so you know which files someone else is working on

▪ Displays differences between versions

5

HOW IS IT WORK?

6

VCS USES A REPOSITORY

▪ check in: adding a new file to the repository

▪ check out: downloading a file from the repo to edit it▪ you don't edit files directly in the repo; you edit a local working copy▪ once finished, the user checks in a new version of the file

▪ commit: checking in a new version of a file(s) that were checked out

▪ revert: undoing any changes to a file(s) that were checked out

▪ update: downloading the latest versions of all files that have been recently committed by other users

7

MERGING AND CONFLICTS▪ Merge: Two sets of changes applied at same time to same files

▪ happens when two users check out same file(s), both change it, and:▪ both commit, or▪ one changes it and commits; the other changes it and does an update

▪ Conflict: when the system is unable to reconcile merged changes▪ resolve: user intervention to repair a conflict. Possible ways:

▪ combining the changes manually in some way▪ selecting one change in favor of the other▪ reverting both changes (less likely)

8

SUBVERSION SVN

▪ Centralized version control systems.

▪ based on the idea that there is a single “central” copy of your project somewhere (probably on a server).

▪ programmers will “commit” their changes to this central copy.

▪ automatically update the contents of any files that were changed.

▪ Programmers no longer have to keep many copies of files on their hard drives manually.

9

DISADVANTAGES OF SVN▪ The repository is centrally stored on a server.

▪ You need to be online to access.

▪ Performance is slow.

10

CENTRALIZED AND DISTRIBUTED VCS

11

VERSION CONTROL SYSTEM

Version Control System VCS

Centralized VCS

Subversion

Distributed VCS

Git

12

▪ Linus Torvalds, 2005

▪ Came out of Linux development community

▪ Initial goals: free and open .

Speed

Support for non-linear development (thousands of parallel branches)

Fully distributed

Able to handle large projects like Linux efficiently

13

ADVANTAGES OF GIT▪ Performing actions other than pushing and pulling changesets is

extremely fast because the tool only needs to access the hard drive, not a remote server.

▪ Committing new changesets can be done locally without anyone else seeing them.

▪ Everything but pushing and pulling can be done without an internet connection.

▪ Since each programmer has a full copy of the project repository, they can share changes with one or two other people at a time if they want to get some feedback before showing the changes to everyone.

14

DISADVANTAGES OF GIT

▪ There are only two major inherent disadvantages to using a distributed system:

▪ If your project contains many large, binary files that cannot be easily compressed, the space needed to store all versions of these files can accumulate quickly.

▪ If your project has a very long history (50,000 changesets or more), downloading the entire history can take an impractical amount of time and disk space.

▪ The authors and contributors of modern distributed version control systems are working on solving these problems, but at the moment, no bundled, built-in features solve them.

15

WORKING WITH GIT▪ Command line interface

▪ • Official Git Site —http://git-scm.com/

16

THANKS A LOTAhmed Shawky Ali El-faky