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. I usually never need to clean up on my 1 man projects, on the others I do it around every 3 or 4 months.In this post I describe some scenarios in which you need to change git branches frequently and why this can sometimes be annoying. I'm aware that you may be referring to exactly the way I do it - are you? In that case, this would be to clean up your dev branches from local after checking out, is that right? In all of my 1 man projects I do it like that, if there's a team ( >1 ), I like to do the "diaspora" workflow I linked to. Personally I may have master, development, and if I really must, a "messing around" branch. Nevertheless, I'm interested in how different people code in their own ways. Not misenterpreting, rather we just have a different workflow, ( a branch per issue if you would like to think at it like that). very large teams - of maybe 15 - 30+ developers would have many branches to be reconciled, but this post states distinctly local work (so I assume, it's on one man's machine, or am I misinterpreting? This could work for a solo project, but on a 2+ man team, this would not work as well. Sill question, maybe, but why not just work with 2, 3 or 4 if you really must branches? There's a post from my friend here: =EnriqueVidal that lets you remove remote branches that have been merged to master, so you can keep things neat on the remote side as well. Also it is useless to keep a 3 month old branch if it has been merged to master or no longer relevant. Most if not all the time, we simply forget or don't care to remove those development branches from our local repository, and thus can take up hard drive space. In short, we create a develpment branch for every issue/bug we want to work on, and then merge into master. This guide over here: it is essentially what we do. I've worked on 2 different companies since I've used Git to manage development for projects. It is interesting to know how other people deal with complexity and how teams manage branches.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |