In my day-job I often work on the CI build process. Unfortunately, it's a scenario I find myself in relatively regularly. Aside from the technical issues we're describing in this post, there's a productivity cost to constant context-switching. This last scenario, working on two separate features at once, sounds like a bad idea. Scenario 3: working on two features at once Unfortunately, as you've already started working on my-feature, this involves the exact same steps as in the previous scenario. Unfortunately, it has a bug, and you need to fix it quickly. In this scenario, you've just finished a feature and pushed it out. This is a conceptually simple set of steps to follow, with the most painful step in my experience being 3-waiting for the IDE to finish doing what it needs to before you can be productive again-and the scenario probably happens rare enough that you don't worry about it too much.Īnecdotally, I've found IDEs get much less "confused" if you use their built-in support for switching git branches, instead of changing them from the command line and waiting for the IDE to "notice" the changes. Once you're done, it's time to switch back, goto 1. From here you can work as normal, commit any changes and push them to the other-feature. For big solutions, it can take a while for the IDE to notice all the changes, reparse the files, and do whatever it needs to do. I find this is often the most painful step, whether I'm using Visual Studio or Rider. Visual Studio, Rider), or you could use the command line git checkout other-feature, or git switch other-feature. Or you could create a "dummy" commit on your branch using git commit -m a "WIP" (which is my preference). You could use git stash -all to save the changes and any new files for all. You offer to checkout their branch to take a look, but that requires a number of steps: The first scenario is when you're working on a feature, coding away on your my-feature branch, when a colleague sends you a message asking to give them a hand with something on their branch other-feature. There are various scenarios I have encountered that require me to switch from one branch to another. Have you ever found yourself having to swap back and forth between different git branches, to work on two different features? Git makes this relatively easy to do, but it can still be a bit annoying and time consuming. Scenarios requiring frequent branch changes Finally I describe how git worktree allows you to check out multiple branches at once, so you can work on two branches simultaneously, without impacting each other. I then present some possible ways to avoid having to change branch. In this post I describe some scenarios in which you need to change git branches frequently and why this can sometimes be annoying.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |