I'm fairly new to git and I'm particularly interested in maintaining test cases for a project within its repository.
I do want the test cases to be in the same repository but perhaps not in the same branch.
Just wanted to keep the branches neat and organized
One trick is to:
See a full example in What's the easiest way to deploy a folder to a branch in git?
You commit your tests in the branch test, that you push.
Then you add that branch as a submodule in master:
git submodule add -b test email@example.com:user/repo.git test git commit -m "added test as submodule" git push
Your checked-out repo (in production) would by default have an empty test subfolder.
If you add (in development) a
git submodule update --init, then the test subfolder would include tests content.
Each time you modify your tests, you add, commit and push from the submodule (which is set to push to the
Then go back to the parent folder (the one in
master branch), add, commit and push the changed gitlink (special entry in the index representing the new SHA1 for the
test submodule repo)