Archive:Development/Tutorials/Git/Intermediate

From KDE TechBase
Revision as of 02:39, 2 November 2009 by Chani (talk | contribs) (git stash)

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