Your SlideShare is downloading. ×
Git introduction
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Git introduction

1,239
views

Published on

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

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

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,239
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • git
  • Git o
  • Transcript

    • 1.  
    • 2.  
    • 3.
        • 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
    • 4.
      •   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.
    • 5.
      • 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
    • 6.
      • 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.
    • 7.
      • 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
    • 8.
      • 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
    • 9.
      • 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.
    • 10.
      • 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.
    • 11.
      • Edit files
      • Stage the changes
      • Review your changes
      • Commit the changes
      • Vim/Eclipse/QtCreator
      • git add (file)
      • git status
      • git commit
    • 12.
      • 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.
    • 13.
      • 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
    • 14.
      • 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.
    • 15.
      • .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)
    • 16.
      • 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/*)
    • 17.
      • 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.
    • 18.
      • 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.)
    • 19.
      • 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
    • 20.
      • 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.
    • 21.
      •   git branch
      • A branch in Git is simply a lightweight movable pointer to the snapshot.
      • Git branch operation is very lightweight.
      • $ git add README INSTALL LICENSE
      • $ git commit -a -m “initial commit of my project”
      •   create a new branch
      • git branch experiment
    • 22.  
    • 23.
      • $ 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
      experiment
    • 24.
      • git merge
      • git checkout default
      • git merge experiment
      • Now experiment branch is merged into default.
      • And the HEAD is at default.
    • 25.
      • 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.
    • 26.
      • 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.
    • 27.
      • 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
    • 28.
      • 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
    • 29.
      • 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
    • 30.
      • 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
    • 31.
      • 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.
    • 32.
      • 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.
    • 33. Thankyou Satyendra.Jaladi