Upload
nyros-technologies
View
1.926
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Seminar Presentation on GIT by Siva Krishna at Nyros Technologies, Kakinada on 16 May, 2009.
Citation preview
Global Information TrackingGlobal Information Tracking
(Git) Git)
By By
Siva Krishna MotamarriSiva Krishna Motamarri
Global Information Global Information TrackingTracking IntroductionIntroduction
AdvantagesAdvantages Steps to install Steps to install msysGit msysGit software to software to
get get GitHub Repository GitHub Repository Creating Repository Under GitHubCreating Repository Under GitHub Exporting Projects to GitHub Exporting Projects to GitHub
RepositoryRepository Importing Repository from GitHubImporting Repository from GitHub More CommandsMore Commands Why GIT Why Not SVN?Why GIT Why Not SVN?
IntroductionIntroduction
Git is a free and open source distributed version control Git is a free and open source distributed version control system used as software configuration Management tool. system used as software configuration Management tool.
Version Control System? And what does it Version Control System? And what does it do?do?
Version Control System: The name itself means controlling Version Control System: The name itself means controlling of code i.e. source code management which allows of code i.e. source code management which allows programmers to easily share the code of their work with programmers to easily share the code of their work with other programmers. By this feature developers can develop other programmers. By this feature developers can develop different feature on the same code by keeping track of all different feature on the same code by keeping track of all old versions. old versions.
IntroductionIntroduction Version control system consists of repository, where all Version control system consists of repository, where all
files resides at one place. A repository works like a files resides at one place. A repository works like a database, which stores each version(history of changes for database, which stores each version(history of changes for any file) as a record. Then repository users can ‘checkout’ any file) as a record. Then repository users can ‘checkout’ working copy. After making required changes then working copy. After making required changes then ‘commit’ changes back to repository, which can create new ‘commit’ changes back to repository, which can create new version (about the files and person who changed it). By this version (about the files and person who changed it). By this way developers can pull and push changes to repository in way developers can pull and push changes to repository in the developed of a web product. This mechanism or the developed of a web product. This mechanism or procedure is the process of version control system. procedure is the process of version control system.
Git is a distributed version control systemGit is a distributed version control system Git does not use a centralized server. Git does not use a centralized server. Git runs on Linux, BSD, Solaris, Darwin, Windows, and Git runs on Linux, BSD, Solaris, Darwin, Windows, and
other operating systems.other operating systems.
AdvantagesAdvantages Git is a Git is a free & open source, distributed version control free & open source, distributed version control
systemsystem designed to handle everything from small to very designed to handle everything from small to very large projects with speed and efficiency.large projects with speed and efficiency.
Every Git clone is a full-fledged repositoryEvery Git clone is a full-fledged repository with with complete history and full revision tracking capabilities, not complete history and full revision tracking capabilities, not dependent on network access or a central server. dependent on network access or a central server.
Branching and merging are fastBranching and merging are fast and easy to do. and easy to do.
Content-tracking rather than file-trackingContent-tracking rather than file-tracking
Smaller Space RequirementSmaller Space Requirement
Steps to install msysGit Steps to install msysGit software to get GitHub software to get GitHub
Repository Repository 1. To upload your projects to your GitHub Repository, You 1. To upload your projects to your GitHub Repository, You have to install latest version Git-version.exe from have to install latest version Git-version.exe from www.code.google.com/p/msysgit/downloads/list and and double clicking the download. double clicking the download.
2. Run Git Bash program to get Git command prompt 2. Run Git Bash program to get Git command prompt
Steps to install msysGit Steps to install msysGit software to get GitHub software to get GitHub
Repository Repository
Steps to install msysGit Steps to install msysGit software to get GitHub software to get GitHub
Repository Repository Then Create a SSH Key , at least one SSH Key is required to upload your project from Your System to Git Hub repository. So create one SSH key for your system by using the below command in github command prompt.
Steps to install msysGit Steps to install msysGit software to get GitHub software to get GitHub
Repository Repository
Steps to install msysGit Steps to install msysGit software to get GitHub software to get GitHub
Repository Repository
Steps to install msysGit Steps to install msysGit software to get GitHub software to get GitHub
Repository Repository Finally copy the public key from “id_rsa.pub” file, it should add Finally copy the public key from “id_rsa.pub” file, it should add
to your account on github repository. to your account on github repository.
Now to identify yourself to git: Now to identify yourself to git:
Go to git bash shell command prompt and type following Go to git bash shell command prompt and type following commands commands
$ git config –global user.name “Your Name Here” $ git config –global user.name “Your Name Here” $ git config –global user.email $ git config –global user.email [email protected]
[note: it should be equal to your email id [note: it should be equal to your email id
at github account]. at github account].
Steps to install msysGit Steps to install msysGit software for GitHub software for GitHub
Repository.Repository. This will set the information stored when you commit to a This will set the information stored when you commit to a
git repo.git repo. Now Copy the ssh-rsa key from the path Now Copy the ssh-rsa key from the path C:\Documents C:\Documents
and Settings\sivakrishna\.sshand Settings\sivakrishna\.ssh
Steps to install msysGit Steps to install msysGit software for GitHub software for GitHub
Repository. Repository. Before copying ssh-rsa key , You have create one account Before copying ssh-rsa key , You have create one account
for your Repository in “http:\\ github.com\”.for your Repository in “http:\\ github.com\”.
Steps to install msysGit Steps to install msysGit software for GitHub software for GitHub
Repository.Repository. Click on your Account information on GitHub Repository
Steps to install msysGit Steps to install msysGit software for GitHub software for GitHub
Repository.Repository.Now Click on “add another public key” under SSH Public Keys.Now Click on “add another public key” under SSH Public Keys.
Creating Repository Under GitHub
Click on “dashboard” link under your GitHub account and Click on “dashboard” link under your GitHub account and
click on “create a repository”click on “create a repository”
Creating Repository Under GitHub
Exporting Projects to Exporting Projects to GitHub Repository GitHub Repository
mkdir Creation mkdir Creation cd Creation cd Creation git init git init touch README touch README git add README git add README git commit -m 'first commit' git commit -m 'first commit'
Exporting Projects to Exporting Projects to GitHub RepositoryGitHub Repository
Now you can push the contents of your Rails directory to Now you can push the contents of your Rails directory to the empty git repository that we created on Github in the the empty git repository that we created on Github in the previous step by running the following command in Git previous step by running the following command in Git Bash shell:Bash shell:
git remote add origin git remote add origin [email protected]:sivakrishna/[email protected]:sivakrishna/Creation.git
git push origin master git push origin master
Exporting Projects to Exporting Projects to GitHub RepositoryGitHub Repository
Importing Repository from Importing Repository from GitHubGitHub
Now we get the repository back to your system , by the following Now we get the repository back to your system , by the following command.command.
Git clone repo_url Git clone repo_url
Ex: git cloneEx: git clone git://github.com/sivakrishna/Creation.git git://github.com/sivakrishna/Creation.git
More CommandsMore Commands TO SCHEDULE THE ADDITION OF ALL FILES TO THE TO SCHEDULE THE ADDITION OF ALL FILES TO THE
NEXT COMMITNEXT COMMIT git add .git add .
TO SEE THE STATUSTO SEE THE STATUS git status git status
TO COMMITTO COMMIT git commit -m “First import” git commit -m “First import”
TO SEE WHAT HAS BEEN COMMITTEDTO SEE WHAT HAS BEEN COMMITTED git ls-files git ls-files
TO SCHEDULE DELETION OF A FILETO SCHEDULE DELETION OF A FILE git rm [file name] git rm [file name]
TO COMMIT ALL CHANGES IN FILES IN THE CURRENT TO COMMIT ALL CHANGES IN FILES IN THE CURRENT REPOSITORYREPOSITORY
git commit -a git commit -a
More CommandsMore Commands TO VIEW THE DIFFERENCE AS YOU COMMIT USE THE -TO VIEW THE DIFFERENCE AS YOU COMMIT USE THE -
v OPTIONv OPTION git commit -v git commit -v
TO VIEW A LOG OF YOUR COMMITSTO VIEW A LOG OF YOUR COMMITS git log git log
TO VIEW A LOG OF YOUR COMMITS WITH A TO VIEW A LOG OF YOUR COMMITS WITH A GRAPH TO SHOW THE EXTENT OF THE GRAPH TO SHOW THE EXTENT OF THE CHANGESCHANGES
git log —stat git log —stat
TO HAVE PAGINATION WHEN VIEWING THE TO HAVE PAGINATION WHEN VIEWING THE LOG FILE USE THE -v OPTIONLOG FILE USE THE -v OPTION
git log -v git log -v
More CommandsMore Commands TO CREATE A NEW BRANCHTO CREATE A NEW BRANCH
git branch [name of your new branch] git branch [name of your new branch] TO PUSH THE NEW BRANCH TO A REMOTE TO PUSH THE NEW BRANCH TO A REMOTE
REPOSITORYREPOSITORY git push origin [new-remote] git push origin [new-remote]
TO PULL A NEW BRANCH FROM A REMOTE TO PULL A NEW BRANCH FROM A REMOTE REPOSITORYREPOSITORY
git fetch origin [remote-branch]:[new-local-branch] git fetch origin [remote-branch]:[new-local-branch] TO VIEW ALL OF THE EXISTING BRANCHESTO VIEW ALL OF THE EXISTING BRANCHES
git branch git branch TO VIEW A LIST OF ALL BRANCHESTO VIEW A LIST OF ALL BRANCHES
git branch -a git branch -a
Why Git Why Not SVN? Security
The key difference between the two systems seems to be the model itself. Where Subversion offers a centralized model, Git provides a decentralized model. At the risk of over simplification, this means that Git offers each developer their very own, fully autonomous copy of the entire repository. With Subversion, each developer has their own working copy, but commits changes to a single, central repository.
Speed
Since each developer has a local copy of the entire repository, fundamental actions like diff, commit, etc. are all local. That’s always going to be faster. Fast is good.That said, server interaction with Subversion isn’t exactly excessive. Developers work in local working directories and only interact with the server in short time.
Why Git Why Not SVN? Smaller Space Requirement
A Subversion working directory contains two copies of the entire code base. One that is actually being worked on and another tucked away in the .svn directory. Repository required ~12Gb of storage in Subversion and ~420Mb in Git.
Key’s for Branches
1. Creating branches in Git is a lot easier than doing this in SVN.
2. When merging the branch back, SVN didn’t know where that branch started. Git keeps track where branches come from. So when creating a branch, merging back is very simple.
3. When merging the branch back, each change was recorded back as the user who did the merge By the Git where as SVN doesn’t. Git keeps commit messages intact, when merging.
Thank You Thank You
Siva Krishna . MSiva Krishna . M