Reputation: 907
I have a large tests suite, that needs to be run before I push my changes back to the repo used by CI. Ideally I would like to use the following workflow:
If I do a git checkout, my whole working copy is changed to that branch, so I can't run my tests. Maybe I should use 2 working copies, but I would prefer a more elegant solution.
edit: typo
Upvotes: 8
Views: 3150
Reputation: 32575
You will have to make a second working copy for this; Consider that your next feature to implement may not be a new branch but instead uses an existing branch or a branch based on a different branch (anything that means you would be checking out code that reverts your last feature implementation during the test run).
You could make a script to handle all of it -- perhaps you finish development of the current feature, then run the "buildandtesteverything {featurebranchname}" script. Script will move up to the directory that contains the root of your git repository, clones the repository into a temporary folder (checking out the named branch), and then executes your tests and cleans up after itself.
Upvotes: 9