4 ms·
Git tricks: stash
- PuercoPop 14y agoIf you want to make a quick fix it in an unrelated function or the same file would be easier to do git add -p <file>. It allows to decide which change to stage.
- loganfsmyth 14y agoI definitely agree that stash is useful, but I'm more of a fan of committing early and often, then squashing using git rebase -i.
- woadwarrior01 14y agoI used to use stash before discovering Kenneth Reitz's legit ( http://www.git-legit.org/ http://www.git-legit.org/ ). With legit, git switch <branchname> automatically stashes and restores uncommitted changes before and after switching branches. One less command to type and sightly higher level.
- ernestipark 14y agoI find stash to be most useful when you want to pull in changes but have a dirty directory.
- Myrmornis 14y ago> Sometimes, something needs fixing ASAP, and you have 260 build-breaking lines an hour away from being commit-worthy If you have 260 lines of code you should have committed it already. I disagree with the article. stash is the wrong solution for a substantial set of changes tied to a particular branch -- instead you should use a temporary branch, and relax about using git reset to rework it later. > clone a new copy of the repository The thought shouldn't even be entering your mind.