Is there a way to work on a file that's on a branch other than the current branch without explicitly switching to that branch?

I have an orphan branch that consists of notes, and another branch where I have my code. I'd like to have an editor constantly open for edit with a file from the notes branch, as well as another editor session open for coding with files from the development branch. Normally I'd have to keep switching back and forth between the branches whenever I want to commit. I wonder if there's a tool that supports this workflow by knowing to commit a file to its respective branch.


If you create another repository and pull the notes branch into it, then you can work on your notes branch in the second working directory

cd ~/project
git checkout notes
git clone ~/project ~/project-notes
cd ~/project-notes

After this, you can edit your notes in the ~/project-notes directory and edit the files in the ~/project directory. Simply pull the notes branch back into ~/project occasionally.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.