Hi
I'm quite new to Git and Sourcetree (so may be being stupid here...let me know if I am) and have been using Sourcetree successfully with differing branches and remerging etc.
If I switch a branch using 'normal Git/Sourcetree'), I need to stash my changes before leaving my current branch. This is good (for me) for (say) two different feature developments. I've now introduced Git Flow and like the concept that it introduces. However, I notice that if I have several Feature branches in development and switch between them, my changes are not stashed and the mods are reflected across each branch, even into the develop branch if I switch to that.
Am I missing something here? I want to be able to switch between different Feature branches and the develop branch and have separate 'source codes' without all modifications being shared across all branches. Is this correct? It seems a bit confusing.
Help and advice appreciated.
Thanks
SourceTree never actually stashes your changes for you, it tries to keep them as you switch branches unless you say otherwise. This is because sometimes you might start developing something, and then realise you're currently on the wrong branch so want to switch over to do the commit.
If you prefer to stash, you should click the Stash button on the toolbar before switching branches. Or alternatively, you could commit locally and not push the changes - you can always amend the commit before pushing next time. Whichever you're most comfortable with.
Thanks, that's helped. My query then is why does Git insist on Stashing when switching 'normal' branches, but not when switching Git Flow branches?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It actually depends on the realtionship between the branches - if there's a direct ancestor for both of them then the switch can occur without stashing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.