jnuss's comments

jnuss | 12 years ago | on: Stashing your work with git

I agree that stashes should be short-lived, but

  % git stash list
will show you what branch was checked out when you stashed. Also, because a stash is represented as a commit, you can know what commit the stash is based on. From the git-stash man page:

"A stash is represented as a commit whose tree records the state of the working directory, and its first parent is the commit at HEAD when the stash was created. The tree of the second parent records the state of the index when the stash is made, and it is made a child of the HEAD commit. The ancestry graph looks like this:

         .----W
        /    /
  -----H----I
where H is the HEAD commit, I is a commit that records the state of the index, and W is a commit that records the state of the working tree."

jnuss | 12 years ago | on: Stashing your work with git

Useful post that taught me a few new tricks about stash.

I like to use stashes as opposed to a "half commit" mentioned by others because conceptually it's not a commit; it represents a chunk of work that is not in a commit-ready state, but is a work in progress. You can (and almost always should, IMHO) include a description of a stash and you also know what commit the stash is based off on and the branch you had checked out when you stashed. Thus, you get the same basic information as a "half commit" while avoiding what for me is a mixing of conceptually different things that I prefer to keep separate.

Of course, to each their own. That's one of the things I love about git is that it offers at least some flexibility to taylor it to what you feel is your optimal workflow.

page 1