Successfully reported this slideshow.

Nyc Code Camp 2010 Git And Github

2,068 views

Published on

Presentation I did at NYC Code Camp about using Git and Github for .NET development on Windows.

  • Be the first to comment

  • Be the first to like this

Nyc Code Camp 2010 Git And Github

  1. 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. 2. What we’re gonna cover <ul><li>Short history of Git </li></ul><ul><li>Differences between Git & Subversion: What’ s a DVCS </li></ul><ul><li>Make a repository and perform operations on it </li></ul><ul><li>How to integrate Git & Subversion </li></ul><ul><li>Short jog through GitHub </li></ul><ul><li>URL For all Links! </li></ul>http://bundl.it/MjYxNjM
  3. 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. 4. What makes Git different? Typical SCMs use changes based on file differences:
  5. 5. What makes Git different? Git thinks of each commit of a snapshot, doesn’t re-save files that weren’t modified – only pointers.
  6. 6. The Staging Area
  7. 7. What does that mean for us? <ul><li>Almost all operations are local. </li></ul><ul><li>Very cheap branching & merging (more in a bit). </li></ul><ul><li>Ability to work offline. </li></ul><ul><li>Entire repository and all its history is with your local copy. </li></ul>
  8. 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. 9. You first repo! <ul><li>. gitignore </li></ul><ul><li>git init </li></ul><ul><li>git add </li></ul><ul><li>git commit </li></ul><ul><li>git status </li></ul><ul><li>.gitignore </li></ul><ul><ul><li>obj </li></ul></ul><ul><ul><li>bin </li></ul></ul><ul><ul><li>_ReSharper.* </li></ul></ul><ul><ul><li>*.csproj.user </li></ul></ul><ul><ul><li>*.resharper.user </li></ul></ul><ul><ul><li>*.resharper </li></ul></ul><ul><ul><li>*.suo </li></ul></ul><ul><ul><li>*.cache </li></ul></ul><ul><ul><li>*~ </li></ul></ul><ul><ul><li>*.swp </li></ul></ul>
  10. 10. Some other operations <ul><li>git commit –m “Message” </li></ul><ul><li>git commit –amend </li></ul><ul><li>git reset HEAD file.txt (Remove from staging area) </li></ul><ul><li>git checkout -- file.txt (Dangerous! File is overwritten) </li></ul><ul><li>git log </li></ul>
  11. 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
  12. 12. Branching & Merging
  13. 13. Rebasing
  14. 14. Remotes $ git remote $ git remote add origin git://github.com/jptoto/project.git $ git fetch / git pull $ git push $ git remote show origin
  15. 15. Github
  16. 16. Git & SVN <ul><li>Use Git as a valid SVN client </li></ul><ul><li>Keep all the client features of Git </li></ul><ul><ul><li>Local branching & merging, staging, etc </li></ul></ul><ul><li>Great way to sneak it into your corporate environment >:-) </li></ul><ul><li>$ git svn [command] </li></ul><ul><li>$ git svn clone svn://path.to.svn.repo </li></ul><ul><li>Caveats: </li></ul><ul><li>Keep history as linear as possible, avoid rebasing </li></ul><ul><li>Don’t re-write your history and do another push </li></ul><ul><li>If you’re on a mixed team, makes sure you’re using SVN server </li></ul>
  17. 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. 18. Helpful References <ul><li>http://progit.org (CC book by Scott Chacon) </li></ul><ul><li> http://www.gitready.com (git tuts) </li></ul><ul><li>http://gitcasts.com/ Screencasts about Git </li></ul><ul><li> http://git.or.cz/course/svn.html Git-SVN hints </li></ul>

×