0

In our organization we have a 'develop' branch we start new work from and eventually merge into.

As is often the case in all organizations, we'll be working on a feature when a bug report comes in and we have to stop what we're doing and fix things, then return to our work.

What I've been doing when this happens is stashing my current work, checking out the develop branch, pulling the latest from our origin, whipping a new branch off develop, fixing things and pushing this new branch up (to github in our case) and moving back to my original branch and carrying on.

The problem I run into is that when I do this is my current, uncommitted work is still there after the stash and when I pull down the develop branch. This causes trouble on occasion and makes things awkward.

I'm aware there are options in stash to deal with this, but I'm a little nervous about trying them out without asking first what the best options are-- I don't want to lose any work if I can help it.

What I'd really like is to 'stash' all my work and get a clean start with the latest version of the develop branch, do what I need to, and when I'm done go back exactly to where I was.

jkj2000
  • 1,563
  • 4
  • 19
  • 26
  • 2
    How exactly are you stashing? Unless you specify `--keep-index`, `git stash` or `git stash save` is supposed to revert your changes and leave you with a clean working directory after creating the stash. With `-u`, the stash-and-revert will also include any new files you might have added. – Aasmund Eldhuset May 20 '15 at 04:36
  • Hmm, good point. I use Atlassian Sourcetree when stashing, and I'm marking the 'keep staged changes" checkbox when doing so, which almost certainly does a --keep-index behind the scenes. – jkj2000 May 20 '15 at 17:05
  • Try unchecking that, then, and see if you get the desired effect... – Aasmund Eldhuset May 20 '15 at 17:10

1 Answers1

0

What about a git format-patch? If you use IntelliJ Idea, it can create them for you.

Generate a git patch for a specific commit

Community
  • 1
  • 1
Ringo
  • 850
  • 9
  • 24