Version control systems & how to use git

15
Version Control Systems

description

slides for a session I made for my colleagues about version control systems & how to use git

Transcript of Version control systems & how to use git

Page 1: Version control systems  & how to use git

Version Control Systems

Page 2: Version control systems  & how to use git

A TOOLto track changes of source code

◦What had changed◦When changed◦Why changed◦Who changed it

What is VCS?

All these data stored in the repository

Page 3: Version control systems  & how to use git

Made a change to code, realized it was a mistake and wanted to revert back?

Lost code or had a backup that was too old? Had to maintain multiple versions of a

product? Wanted to share your code, or let other

people work on your code? Wanted to experiment with a new feature

without interfering with working code?

Why we should use VCS?

Page 4: Version control systems  & how to use git

Types of VCSCentralized version control

Page 5: Version control systems  & how to use git

Types of VCSDistributed version control

Page 6: Version control systems  & how to use git

Repository : kind of DB stores changes on source code during its life

Working directory : local directory of files, where you make changes

Revision: snapshot of code at specific time Head: The latest revision in current branch

Definitions

Page 7: Version control systems  & how to use git

Eclipse◦ Egit◦ Gitblit◦ ….

Netbeans◦ Builtin plugin

Stand alone tools◦ tortoiseGit◦ SourceTree◦ ….

Implementations & plugins

Page 8: Version control systems  & how to use git

Create Local Repository(initiate)◦ Eclipse

RC team share create Repository◦ Tortoise

RC git create Repository

Commit changes to Repo(don’t forget the message)◦ Tortoise

RC git commit◦ Eclipse

RC team commit

Commands (local)

Page 9: Version control systems  & how to use git

Diff: compares 2 versions◦ Eclipse

RC compare with◦ Tortoise

RC tortoise Git diff / diff with … Log: shows entire history of repository

◦ Eclipse RC team show in history

◦ Tortoise RC tortoise git show log

Commands (local)

Page 10: Version control systems  & how to use git

Branch: create new branch in repository tree◦ Eclipse

RC team switch to (new-branch / existing one)◦ Tortoise

RC tortoise git create branch / switch Merge work on one branch into another

◦ Eclipse RC team merge

◦ Tortoise RC tortoise git merge

(local) Commands

Page 11: Version control systems  & how to use git

Clone: creates a local copy of remote repository◦ Eclipse

Git perspective clone icon◦ Tortoise

RC git clone Pull: grab change from remote repository

◦ Eclipse RC team pull

◦ Tortoise RC tortoise git pull

(remote) Commands

Page 12: Version control systems  & how to use git

Push : sends changes to remote repository◦ Eclipse

RC team remote push◦ Tortoise

RC tortoise git push

(remote) Commands

Page 13: Version control systems  & how to use git

Do not commit half-done work Use descriptive commit messages Use branches Don’t commit generated files

Best practices

Page 14: Version control systems  & how to use git

www.git-scm.com Version control by Example (free book) Pro Git (free book)

References

Page 15: Version control systems  & how to use git

Thank you