Changes for page Getting Started with Git
Last modified by Bastian Triller on 2013/05/21 17:24
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. jbrook1 +XWiki.kiddyr - Content
-
... ... @@ -3,9 +3,6 @@ 3 3 = Got Git? No? Get Git = 4 4 5 5 * Official Download Site: [[http://git-scm.com/download]] 6 -* Direct Download Links: 7 -** MacOS X [[.dmg Binary Installers>>http://code.google.com/p/git-osx-installer/]] 8 -** Microsoft Windows [[.exe Binary Installers>>http://code.google.com/p/msysgit/]] 9 9 10 10 {{info title="Git is included with XCode 4.x"}} 11 11 ... ... @@ -32,7 +32,6 @@ 32 32 33 33 * Git Cheat Sheets 34 34 ** [[http://cheat.errtheblog.com/s/git/]] 35 -** [[http://ktown.kde.org/%7Ezrusin/git/git-cheat-sheet-medium.png]] 36 36 37 37 * [[Linus Torvalds talks about git>>http://www.youtube.com/watch?v=4XpnKHJAok8]] 38 38 Have a Good Laugh here as Linus Torvalds Evangelizes git. //NOTE: This isn't really learning, but it is way more fun and gives you insight into the motivation behind git.// ... ... @@ -175,3 +175,19 @@ 175 175 git reset --hard 176 176 177 177 {{/code}} 174 + 175 +=== Stash to Clean and Checkout from Stash to Work === 176 + 177 +Say that you have several different things going on in your project at any one time. How can you seperate them to check something in? You know about the "git stash" command, which cleans up your project. But what if you want part of the dirtiness, but not all of it? 178 + 179 +Suppose you have file1.java, file2.java, file3.java, and file4.java. You have a single feature implemented in file1.java and file3.java and those edits stand on their own. If you are going to check in just file1.java and file3.java, you should test them on their own, without your other changes. First, do a "git stash". A "git status" will show you have no staged changes. Now do: 180 + 181 +{{code}} 182 + 183 +git checkout stash@{0} -- file1.java 184 +git checkout stash@{0} -- file3.java 185 + 186 +{{/code}} 187 + 188 +Now you have your two files and not the others and you can build and test them in a clear project before you check them in! 189 +One odd thing I noticed is this. The "git diff" you were doing before the stash will show your changes. Now you have to do "git diff HEAD". Not completely sure why, but there it is.