SwimBikeRun
SwimBikeRun

Reputation: 4470

git workflow: how to properly switch task between two interdependent branches?

I have feature A and Feature B, each being developed on a separate branch, A and B respectively.

When I have A done, I run it to test it. I would like to immediately start working on B while A is testing. However, I am going to be actively changing files (mostly additions) while A is running. At various points in time, files A relies on may not compile correctly because I am actively working on them.

Furthermore, as A is testing, I am going to want to fix little things here and there with A. I don't want to have to stash on B, go to A, make the change, then come back to B for every little change.

Apart from getting a different test machine to pull a specific commit hash of the repo and test it while I continue to work on it elsewhere, what solutions exist for this problem? My method has been to copy the entire git directory so I have another space to temporarily work in while the original directory temporarily acts as a testing location.

Upvotes: 0

Views: 199

Answers (1)

torek
torek

Reputation: 489828

Assuming you need separate work-areas in which to run tests (that the tests would otherwise step on each other), your current method—using an extra copy of the repository—is good. The only way to make it better, with an opinion punctuation mark around the word "better", would be to use git worktree add to share the underlying repository while having two separate work-trees.

(git worktree is new in Git 2.5, with various fixes over time; I'd recommend having at least 2.6 before using it.)

Upvotes: 1

Related Questions