• Save
Git introduction
Upcoming SlideShare
Loading in...5

Git introduction



Gives an abstract idea about what a version control system(git) is?

Gives an abstract idea about what a version control system(git) is?



Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment
  • git
  • Git o

Git introduction Git introduction Presentation Transcript

      • What is versioncontrol
      • What is Git
      • Installing Git
      • A Short History of Git
      • How git is different
      • Understanding Difference
      • A Basic Workflow
      • Git Commands
      • Bibliography
    •   Version control system is a system that records changes to a file or set of files over time.
    • Version Control System (VCS) allows you to revert individual files or entire project back to a previous state.
    • Allows you to compare changes over time, see who last modified something that might be causing a problem, who introduced an issue and when, and more useful things than just a time stamped directory.
    • Git  is an open source distributed version control system with an emphasis on speed and efficiancy.
    • Git was initially designed and developed by LinusTorvalds  for Linux Kernal Developement.
    • “ I”m an egotistical bastard, and I name all my projects after myself. First Linux, now git.” – Linus
    • Daily snapshots of the main Git development branch are available at
    •   http://codemonkey.org.uk/projects/git-snapshots/git/
    • UBUNTU- apt-get git-core
    • WINDOWS- http://code.google.com/p/msysgit/downloads/list
    • Get the installer and follow onscreen instructions.
    • During Linux kernel maintenance (1991–2002), software changes were passed around as patches and archived files. In 2002, BitKeeper a proprietary SCM project started.
    • In2005 company that developed BitKeeper broke down,so the tool was nolonger offered free of cost.
    • In April 2005 Linus Torvalds,wrote his own source code management system that became what is now called as Git.
    Linux Logo
    • Everything is local,and fully distributed.means
    • Not just check out latest snapshot of the files but fully mirror the repository.
    • So  if the server dies, or the harddisk of central database becomes corrupted any of the client repositories can be copied back up to the server to restore it.
    • Every checkout is really a full backup of all the data.
    • In SVN and CVS, you can edit files, but you can’t commit changes to your database,when you are not connected to the server
    • Performing a diff
    • Viewing file history
    • Committing changes
    • Merging branches
    • Obtaining any other revision of a file
    • Switching branches
    • No Network Needed for the above operations.
    • Git Stores Data as snapshots of project over time.
    •   basically git takes a picture of how all your files look like at that moment and stores a reference to that snapshot.
    • Others store data as changes to a base version of each file.
    • Edit files
    • Stage the changes
    • Review your changes
    • Commit the changes
    • Vim/Eclipse/QtCreator
    • git add (file)
    • git status
    • git commit
    • You modify files in your working directory.
    • You stage the files, adding snapshots of them to your staging area.
    • You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory.
    • you can easily push changes to a remote server when you get to a network connection.
    • git config
    • git config --global user.name “satyendra.Jaladi”
    • git config --global user.email [email_address]
    • This is stored in ~/.gitconfig file or etc/gitconfig or .git/config
    • To view the configuration
    • cat ~/.gitconfig
    • git init
    • Initializing a Repository in ExistingDirectory.
    • creates a .git(hidden)directory in your current working directory that is currently empty.
    • A working tree(repository) has a .git directory at the top level.
    • .git directory contents:-
    • config -- configuration file, just like a .ini file.
    • objects/* -- The object repository.
    • refs/heads/* -- branches.eg:master,userdefnd
    • refs/tags/* -- tags [41 char strings]
    • logs/* -- logs
    • refs/remotes/* -- tracking others work
    • Index – the index “cache” (speeds things up)
    • Index is a directory of blob objects.it represents the next commit,index does the staging.
    • “ add files ” to put them in the index,including current content(i.e files are staged for commit)
    • “ Commit” – takes the current index and makes it a real commit object.
    • HEAD – points to the current branch.(where commits occur.contains a pointer to refs/heads/*)
    • Cloning an Existing Repository
    • git clone
    • git clone git://gitorious.org/qt-mobility/qt-mobility.git
    • Files are pulled into qt-mobility directory.
    • git clone git://gitorious.org/qt-mobility/qt-mobility.git mymobility . Files are pulled into mymobility directory.
    • git add
    • echo "TODO: Create documentation" > README.txt
    • notepad README.txt add some text and save it.
    • touch README.txt
    • git add README.txt
    • git add Filename works for individual files.
    • git add .
    • This will add all of your current files into your new repository --index (i.e files are staged for commit.)
    • git commit
    • After making changes to README.txt the file is staged and ready for commit.this is observed with git status or git diff.
    • Git commit will launch the editor $EDITOR env variable.or choice editor is set with
    • git config --global core.editor  
    • Skip Approach. git commit –a -m "Story 01: Fix failing case”
    • skip the staging area.(i.e git add is skipped.)  easy
    • git log
    • After cloning a repo git clone git://gitorious.org/qt-mobility/qt-mobility.git.
    • Want to know what has happened in this repo.
    • git log command does the job in command prompt.
    • Gitk is a gui version of the git log command.
    • This lets you know every detail in the repo.
    • gitk& --- launches the git visualizer.
    •   git branch
    • A branch in Git is simply a lightweight movable pointer to the snapshot.
    • Git branch operation is very lightweight.
    • $ git commit -a -m “initial commit of my project”
    •   create a new branch
    • git branch experiment
    • $ git branch
    • * default
    • experiment
    • Check the HEAD is on default.
    • git checkout experiment
    • Now Check the HEAD is on experiment
    • git checkout default
    • * default
    • experiment
    • git merge
    • git checkout default
    • git merge experiment
    • Now experiment branch is merged into default.
    • And the HEAD is at default.
    • git protocols
    • file:// Protocol--( Local protocol) git clone file:///opt/git/project.git
    • http/s Protocol --(slow)  The fetch process is a series of GET requests.
    •   ssh:// Protocol—(efficient) git clone user@server:project.git (or)
    • git push origin master (efficaint transport protocol)
    •   git:// Protocol (Fast) $ git clone http://example.com/gitproject.git
    • git is a special daemon that comes packaged with Git. it listens on a dedicated port (9418).
    • git Protocol is similar to the SSH protocol but without encryption and authentication overhead.
    • Generate SSH Public Key
    • $ cd ~/.ssh
    • $ ls
    • authorized_keys2 id_dsa known_hosts
    • config id_dsa.pub
    • ssh-keygen -t rsa Password is not needed so press Return for all prompts.
    • cat ~/.ssh/id_rsa.pub
    • This is the public key that you are required to copy and paste into your account on github/gitorious.
    • git pull
    •   git pull fetches from origin by default and merges into the current branch.
    • $ git pull origin/task1
    • $ git fetch origin/task1; git merge origin/task1.
    • (Git pull == git fetch+git merge).
    • After git clone http://git.gitorious.org/qt-mobility/qt-mobility.git mymobility.
    • After some duration of time this repo may not be up to date,so fetch an update.
    • git fetch origin
    • After the fetch, task1 will be different. ‘origin/ task1 ’ will now point to one of the new commit objects downloaded during the fetch.
    • we can merge ‘origin/ task1 ’ into our local ‘ task1 ’ branch.
    • The above two operations are equivalent to
    • git pull origin/task1
    • git push
    • To push the changes to other repositories.
    • Git push is possible only when you have commit rights on the repo.(usually over ssh)
    • git push experiment master
    • Push the changes in the experiment branch to the remote master branch
    • Git help
    • git [command] –help
    • git help [command]
    • Daily Usage commands
    • git init git clone git add git commit
    • git branch git checkout git merge git remote
    • git fetch git push git diff git log
    • GitHub offers both commercial plans and free accounts for open source projects that use git.
    • GitHub offers social networking functionality like feeds, followers and the network graph to display how developers work.
    • Gitorious provides open source infrastructure for hosting open source projects that use Git.
    • Gitorious also offers most of the features that are offered through the github.
    • https://github.com/
    • http://gitorious.org/
    • git-scm.com
    • gitcasts.com
    • learn.github.com
    • #git / #github on IRC
    • A Tutorial Introduction to Git ( http://www.kernel.org/pub/software/scm/git/docs/tutorial.html )
    • Note:-All the commands(git or os specific) in the presentation are in a lowercase comapred to the normal text.
  • Thankyou Satyendra.Jaladi