Coder Social home page Coder Social logo

Comments (9)

nvie avatar nvie commented on May 20, 2024

Fair. I might have been a bit too strict with this one. (It regularly itches me, too.)

from gitflow.

nvie avatar nvie commented on May 20, 2024

Maybe not stash the changes away, but simply remove the check for local changes and let git determine if it can switch branches itself?

from gitflow.

Zoramite avatar Zoramite commented on May 20, 2024

Looking into the specific commands it looks like this basic idea would work:

git stash
... do stuff ...
git stash pop

if it dies while 'doing stuff' we may want to do a git stash pop before exiting to get it back to where it was before it was started.

from gitflow.

Zoramite avatar Zoramite commented on May 20, 2024

That is true, git will give its own error if it can't branch.

from gitflow.

nvie avatar nvie commented on May 20, 2024

I'm tempted to have a very conservative additude against these kind of implementations. Think worst case: what if git stash fails (somehow)? And what if git stash pop fails? That's two more sanity checks and remembering state in between. Not to mention that Git's porcelain does not provide the best ways to do these sanity checks in the first place.

If this can be tackled by removing one of our sanity checks and leaving the figuring out of whether branching is currently possible to Git, we have a solid implementation. If Git is unable to start a new branch somehow, we should quit and let the user deal with it. This is probably for the better anyway, since that should be an exceptional case.

from gitflow.

Zoramite avatar Zoramite commented on May 20, 2024

Agreed, it would be difficult for gitflow to maintain the state. I'm all for just removing the extra check.

from gitflow.

nvie avatar nvie commented on May 20, 2024

Heh, this is a bit lame: looking at the source code, I apparently added the option -f (force) for this already. The question now is: should this become the default behaviour or just keep it this way?

from gitflow.

Zoramite avatar Zoramite commented on May 20, 2024

From my ignorant view it would seem better to have it try the branch and fail with the git message than have to fail, then force, then fail again.

But we may need to look into what other actions occur between when the check for a 'dirty' workspace and the branch code. Is there anything that gets stored between the check and the branch creation that would mess up the process?

from gitflow.

nvie avatar nvie commented on May 20, 2024

Yeah, you're absolutely right. Fixed in 4132de9.

from gitflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.