Comment

Comment by coldtea

>Let's take an example. Let's say you are working on a feature. Your boss interrupts you (, bosses, right?) and says "we need this bug fixed". Or maybe you just notice the bug as you're working. Whatever it is, you need to switch contexts while in the middle of something. Now you have a few options.

- You can fix the bug and commit it into your feature branch and try to get them both deployed together.

- You can stash everything, create a new branch, switch to it, fix the bug, commit and push it, then switch back to what you were working on.

- You could locally clone the repository to a new directory and work on the other branch there, then push it back into the main one and then push from there back upstream.

--

What?

Why couldn't you, like, create another branch off of main, switch to that, and fix the bug there, then resume working on your feature branch?

Then when one of the two (bugfix or feature branch) is merged into main, you rebase main into the other.

parent coldtea 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton