Right now, I am adding unit tests to a project based on Angular. As we are working in an Agile mode, the user stories, designs and tasks will often change. Therefore, we try to break components into smaller yet manageable ones.
By doing so, we focus on writing tests on their respective feature branch instead of using a single branch.
The main work is on the Develop branch. I've added a few tests on another branch namely feature/feature-1. Now I've checked out on yet another branch - feature/feature-2 directly from develop - without merging the work of feature-1 on develop.
I therefore don't have the modifications from the first branch on my current one.
As I am in the process of adding tests and I only need a small reference to lookup, I prefer looking at the file instead of having to change branch.
Even a stash will be a lot of work - as once the branch is changed - there is a build process that takes some time. I don't want to lose the flow.
A nice built in solution is using the GUI installed along with Git.
The command is:
git gui browser <branch>
The GUI browser will load with the content of the branch you want.