Archive:Development/Tutorials/Git/Intermediate: Difference between revisions

From KDE TechBase
(Created page with ' Once you're comfortable committing code with git, there are some simple things that can save you time and effort... TODO *git stash *feature branches for fun and profit *shared...')
 
(git stash)
Line 1: Line 1:
Once you're comfortable committing code with git, there are some simple things that can save you time and effort...
Once you're comfortable committing code with git, there are some simple things that can save you time and effort...


TODO
TODO
*git stash
*feature branches for fun and profit
*feature branches for fun and profit
*shared branches?
*shared branches?
== Handling local changes: git stash ==
Sometimes (eg. when using git svn rebase) Git won't let you proceed if you have uncommitted changes. If you don't want to commit those changes, you can use git stash instead. This command stores the local changes safely out of the way on a stack. When you want those changes back it can re-apply them to your repository and clear the stack. A very handy feature in many situations! Just do this:
<code>
git stash
git svn rebase # or whatever it was you were trying to do
git stash pop # apply-and-clear
</code>
There are more features of git stash explained in the fine manual. :)
<code>
git help stash
</code>

Revision as of 02:39, 2 November 2009

Once you're comfortable committing code with git, there are some simple things that can save you time and effort...

TODO

  • feature branches for fun and profit
  • shared branches?

Handling local changes: git stash

Sometimes (eg. when using git svn rebase) Git won't let you proceed if you have uncommitted changes. If you don't want to commit those changes, you can use git stash instead. This command stores the local changes safely out of the way on a stack. When you want those changes back it can re-apply them to your repository and clear the stack. A very handy feature in many situations! Just do this:

git stash git svn rebase # or whatever it was you were trying to do git stash pop # apply-and-clear

There are more features of git stash explained in the fine manual. :) git help stash