SlideShare a Scribd company logo
Git & Github for .NET Development JP Toto VP for Application Development Cognis IT  http://www.cognisit.com [email_address]   @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 “joe@gmail.com "
You first repo! . gitignore git init git add git commit git status .gitignore obj bin _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 & Merging Very 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: Keep history as linear as possible, avoid rebasing Don’t re-write your history and do another push 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

More Related Content

Nyc Code Camp 2010 Git And Github

  • 1. Git & Github for .NET Development JP Toto VP for Application Development Cognis IT http://www.cognisit.com [email_address] @jptoto Fill this space with whatever you want (graphic, logo, whatever)
  • 2. 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
  • 3. 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.
  • 4. What makes Git different? Typical SCMs use changes based on file differences:
  • 5. What makes Git different? Git thinks of each commit of a snapshot, doesn’t re-save files that weren’t modified – only pointers.
  • 7. 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.
  • 8. Installing Git Msysgit Tortoise GIT Git Extensions for Visual Studio $ git config --global user.name “Joe Smith&quot; $ git config --global user.email “joe@gmail.com &quot;
  • 9. You first repo! . gitignore git init git add git commit git status .gitignore obj bin _ReSharper.* *.csproj.user *.resharper.user *.resharper *.suo *.cache *~ *.swp
  • 10. 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
  • 11. Branching & Merging Very 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
  • 14. Remotes $ git remote $ git remote add origin git://github.com/jptoto/project.git $ git fetch / git pull $ git push $ git remote show origin
  • 16. 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: Keep history as linear as possible, avoid rebasing Don’t re-write your history and do another push If you’re on a mixed team, makes sure you’re using SVN server
  • 17. 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
  • 18. 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