Download - Nyc Code Camp 2010 Git And Github
![Page 1: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/1.jpg)
Git & Github for .NET Development
JP TotoVP for Application Development
Cognis IT http://[email protected] @jptoto
Fill this space with whatever you want (graphic, logo, whatever)
![Page 2: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/2.jpg)
What we’re gonna cover
• Short history of Git• Differences between Git & Subversion: What’ s a DVCS• Make a repository and perform operations on it• How to integrate Git & Subversion• Short jog through GitHub
URL For all Links!
http://bundl.it/MjYxNjM
![Page 3: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/3.jpg)
History of Git
In 2005, the relationship between the community that developed the Linux kernel and the commercial company that developed BitKeeper broke down, and the tool’s free-of-charge status was revoked. This prompted the Linux development community (and in particular Linus Torvalds, the creator of Linux) to develop their own tool based on some of the lessons they learned while using BitKeeper.
Ohai! BitKeeper screwed us so I think I’ll write my
own DVCS. Natch.
![Page 4: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/4.jpg)
What makes Git different?
Typical SCMs use changes based on file differences:
![Page 5: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/5.jpg)
What makes Git different?Git thinks of each commit of a snapshot, doesn’t re-save files that weren’t modified – only pointers.
![Page 6: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/6.jpg)
The Staging Area
![Page 7: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/7.jpg)
What does that mean for us?
• Almost all operations are local.• Very cheap branching & merging (more in a bit).• Ability to work offline.• Entire repository and all its history is with your local copy.
![Page 8: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/8.jpg)
Installing Git
Msysgit
Tortoise GIT
Git Extensions for Visual Studio
$ git config --global user.name “Joe Smith" $ git config --global user.email “[email protected]"
![Page 9: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/9.jpg)
You first repo!.gitignore
• git init• git add• git commit• git status• .gitignore
objbin_ReSharper.**.csproj.user*.resharper.user*.resharper*.suo*.cache*~*.swp
![Page 10: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/10.jpg)
Some other operations
• git commit –m “Message”• git commit –amend• git reset HEAD file.txt (Remove from staging area)• git checkout -- file.txt (Dangerous! File is overwritten)• git log
![Page 11: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/11.jpg)
Branching & MergingVery FAST! Only uses pointers instead of copying whole files, folders, and projects.
Git encourages lots of branching / merging.
$ git branch <new branch>
$ git checkout <new branch>
$ git merge
$ git branch –D <branch_to_delete>
$ git mergetool
![Page 12: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/12.jpg)
Branching & Merging
![Page 13: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/13.jpg)
Rebasing
![Page 14: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/14.jpg)
Remotes
$ git remote
$ git remote add origin git://github.com/jptoto/project.git
$ git fetch / git pull
$ git push
$ git remote show origin
![Page 15: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/15.jpg)
Github
![Page 16: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/16.jpg)
Git & SVN• Use Git as a valid SVN client• Keep all the client features of Git
• Local branching & merging, staging, etc• Great way to sneak it into your corporate environment >:-)
$ git svn [command]$ git svn clone svn://path.to.svn.repo
Caveats:1.Keep history as linear as possible, avoid rebasing2.Don’t re-write your history and do another push3.If you’re on a mixed team, makes sure you’re using SVN server
![Page 17: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/17.jpg)
What if I’m used to SVN?
$git clone [url] $svn checkout [url]
$git pull $svn update
$git init $svnadmin create “repo”$git add . $svn import file://repo$git commit
$git merge [branch] $svn merge -r 20:HEAD http://url/branches/branch
![Page 18: Nyc Code Camp 2010 Git And Github](https://reader033.vdocument.in/reader033/viewer/2022061218/54b783084a79592a758b45b7/html5/thumbnails/18.jpg)
Helpful References
• http://progit.org (CC book by Scott Chacon)• http://www.gitready.com (git tuts)• http://gitcasts.com/ Screencasts about Git• http://git.or.cz/course/svn.html Git-SVN hints