Version control systems & how to use git
-
Upload
ahmed-dalatony -
Category
Software
-
view
49 -
download
4
description
Transcript of Version control systems & how to use git
Version Control Systems
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
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?
Types of VCSCentralized version control
Types of VCSDistributed version control
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
Eclipse◦ Egit◦ Gitblit◦ ….
Netbeans◦ Builtin plugin
Stand alone tools◦ tortoiseGit◦ SourceTree◦ ….
Implementations & plugins
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)
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)
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
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
Push : sends changes to remote repository◦ Eclipse
RC team remote push◦ Tortoise
RC tortoise git push
(remote) Commands
Do not commit half-done work Use descriptive commit messages Use branches Don’t commit generated files
Best practices
www.git-scm.com Version control by Example (free book) Pro Git (free book)
References
Thank you