Upload
jptoto
View
1.876
Download
2
Embed Size (px)
DESCRIPTION
Presentation I did at NYC Code Camp about using Git and Github for .NET development on Windows.
Citation preview
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)
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
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.
What makes Git different?
Typical SCMs use changes based on file differences:
What makes Git different?Git thinks of each commit of a snapshot, doesn’t re-save files that weren’t modified – only pointers.
The Staging Area
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.
Installing Git
Msysgit
Tortoise GIT
Git Extensions for Visual Studio
$ git config --global user.name “Joe Smith" $ git config --global user.email “[email protected]"
You first repo!.gitignore
• git init• git add• git commit• git status• .gitignore
objbin_ReSharper.**.csproj.user*.resharper.user*.resharper*.suo*.cache*~*.swp
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
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
Branching & Merging
Rebasing
Remotes
$ git remote
$ git remote add origin git://github.com/jptoto/project.git
$ git fetch / git pull
$ git push
$ git remote show origin
Github
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
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
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