Upload
abhishek-parolkar
View
1.133
Download
1
Tags:
Embed Size (px)
DESCRIPTION
A presentation on GIT
Citation preview
Beyond Version Controlling with GITBeyond Version Controlling with GIT
By: Abhishek Parolkar
This presentation is licensed under:Creative Commons AttributionNoncommercialNo Derivative Works 2.5 India
Who am I?
Agenda1.) “We, the coders of this universe” 2.) “We, the coders for this universe”3.) SCM – in history4.) Distributed SCM5.) Welcoming the change in perpective.6.) Learning GIT
“We, the coders of this universe”
Code = > Idea => Code =>Innovate
“We, the coders for this universe”
Communicate => Build => Collaborate => Contribute
SCM – in history
Only two ways of making change
SCM – in historyLockModifyUnlock
SCM – in historyCopyModifyMerge
So, Whats wrong here?
When you lock the file, others have nothing to do....
...so they wait for their chance !
...... to lock you ;)
When you are working on an innovative immplementation...Your fellow commiter gives you a call and says ...
“Dude!, Update and resolve conflicts”
If you are really really good, you get to grow a branch...
:)Wow!
But, practically,...branches never merge
In centralised system of version control , you surely hurt many innocent souls
So, finally , you invite anger!
Courtesy: http://www.bbspot.com/Images/News_Features/2007/04/madspidey.jpg
Introducing GIT
The distributed source code management tool
What is Git?"Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both highlevel operations and full access to internals."
* Branching is fast and easy. * Offline work is supported; local commits can be submitted later. * Git commits are atomic and projectwide, not perfile as in CVS. * Every working tree in Git contains a repository with a full project history. * No Git repository is inherently more important than any other.
Getting startedTwo ways:
1.) make a repository from local source directory$ cd sourcedir$ gitinit
2.) Clone others repository
$ gitclone git://git.kernel.org/.../git/torvalds/linux2.6.git linux2.6
use gitpull for fastforwardmerge
If you have an archive of the source tree
$ tar zxf sneos.tar.gz$ cd sneos$ git init$ git add . $ git commit m "import sneos source tree."$ git tag v1.1
Everybody uses these commands to maintain git repositories.
* gitinit or gitclone to create a new repository. * gitfsck to check the repository for errors. * gitgc to do common housekeeping tasks such as repack and prune.
For Individual Developer (Standalone)
A standalone individual developer does not exchange patches with other people, and works alone in a single repository, using the following commands.
* gitshowbranch to see where you are. * gitlog to see what happened. * gitcheckout and gitbranch to switch branches. * gitadd to manage the index file. * gitdiff and gitstatus to see what you are in the middle of doing. * gitcommit to advance the current branch. * gitreset and gitcheckout (with pathname parameters) to undo changes. * gitmerge to merge between local branches. * gitrebase to maintain topic branches. * gittag to mark known point.
Create a topic branch and develop.
$ git checkout b alsaaudio $ edit/compile/test $ git checkout curses/ux_audio_oss.c $ git add curses/ux_audio_alsa.c $ edit/compile/test $ git diff HEAD $ git commit a s $ edit/compile/test $ git reset soft HEAD^ $ edit/compile/test $ git diff ORIG_HEAD $ git commit a c ORIG_HEAD $ git checkout master $ git merge alsaaudio $ git log since='3 days ago' $ git log v2.43.. curses/
Individual Developer (Participant)
* gitclone(1) from the upstream to prime your local repository. * gitpull(1) and gitfetch(1) from "origin" to keep uptodate with the upstream. * gitpush(1) to shared repository, if you adopt CVS style shared repository workflow. * gitformatpatch(1) to prepare email submission,
if you adopt Linux kernelstyle public forum workflow.
Example:$git clone git://git.kernel.org/pub/scm/.../torvalds/linux2.6 my2.6$ cd my2.6$ edit/compile/test; git commit a s (1)$ git formatpatch origin (2)$ git pull (3)$ git log p ORIG_HEAD.. arch/i386 include/asmi386 (4)$ git pull git://git.kernel.org/pub/.../jgarzik/libatadev.git ALL (5)$ git reset hard ORIG_HEAD (6)$ git gc prune (7)$ git fetch tags (8)
Integrator
* gitam to apply patches emailed in from your contributors. * gitpull to merge from your trusted lieutenants. * gitformatpatch to prepare and send suggested alternative to contributors. * gitrevert to undo botched commits. * gitpush to publish the bleeding edge.
Repository Administration
* gitdaemon to allow anonymous download from repository. * gitshell can be used as a restricted login shell for shared central repository
users.
Thank you!
I am just a click away, [email protected]
Blog: http://abhishek.parolkar.com
Find more here:http://www.kernel.org/pub/software/scm/git/docs/everyday.htmlhttp://www.versioncontrolblog.com/http://www.russellbeattie.com/blog/distributedrevisioncontrolsystemsgitvsmercurialvssvn