Git Questions – How do I switch branches without losing my work?

We regularly get questions about how to achieve a particular thing – as developers there are parts of our workflow which trip us up, that our tools can help us with if we understand how.  So we’ve decided to start answering these real world questions with videos showing what to do.

The first video features me, Trisha Gee (Developer Advocate for IntelliJ IDEA) and Gary Hockin (Developer Advocate for PhpStorm) answering the question “How do I switch branches without losing the code I was working on?”. Through frequent battles with Git I have learnt there’s always more than one way to do things, so in this video we present two different options.  We’re also two advocates using two different IDEs, coding in two different languages – many challenges we face as developers aren’t unique to our language or tool.

We’re really interested in what you think of this more informal format – it’s more like a video podcast than a screencast. We’d also love to hear what questions or problems you’d like us to tackle in future videos.

This entry was posted in Tips & Tricks and tagged , , , . Bookmark the permalink.

15 Responses to Git Questions – How do I switch branches without losing my work?

  1. Anon says:

    Why is the resolution of this video so low?

  2. Dimitar Dimitrov says:

    Please keep writing. I find it much easier to read than to follow a video.

  3. Yuri Volkov says:

    I agree with Dimitar: please keep writing.
    Two paragraphs about that “two options” would be far quicker to find and to understand than watching video (which I personally didn’t do although I’m curious. Think of this!)

  4. Zoot99 says:

    I like the video better than just text, because it shows you what menu items or buttons are being clicked as you switch branches.

  5. Gauthier P says:

    I like this new format, it can help new comers to discover the IDE easily and it’s more interactive than a blog post. Also, it’s more friendly than a long blog post explaining how to do things (moreover, the Doc already explains everything).

    Looking forward for the next video !
    And I can see that IDEA still have repainting issues :’) But I was pretty sure this issue was fixed now ( “)

    • Trisha Gee says:

      I think the repainting issue here is simply because Gary switched themes without restarting, or it might be because he switched themes but didn’t update his editor settings. I don’t think it’s a problem for most people.

      • Gauthier P says:

        I sometimes switch between themes, and it automatically change the color scheme (when using the color scheme associated with the look and feel) and even without restarting, the problem doesn’t occurs most of the time. :)

  6. Trisha Gee says:

    Don’t worry, we will keep writing as well – this is an additional format, it won’t replace our traditional blogs and help documents. If people find it useful, we’ll keep doing it.

  7. cupakob says:

    git stash

    and git stash apply or git stash pop

    do the same 😉

    • Trisha Gee says:

      Yes, absolutely. These are two alternatives are good for those who prefer not to work directly with the command line (and they have other advantages/disadvantages as well).

  8. Ron says:

    I have seen this now in several jetbrains videos that on the bottom the shortcut appears. What setting or plugin is that? Apart from that nice video about the git fork

  9. Leif Theden says:

    Maybe do both? Spending 7+ minutes to watching a presentation to figure out what I could read in 1 minutes is a waste of time.

Leave a Reply

Your email address will not be published. Required fields are marked *