You’re working on a branch. Let’s say it’s the master
branch.
You have another branch. Let’s call it abandoned
.
You don’t care about the abandoned
branch, except for one useful file. Let’s call it useful.txt
.
Don’t do this:
$ git checkout abandoned
[human manually copies `useful.txt` to their clipboard]
$ git checkout master
[human manually creates a new file and pastes into it]
$ git checkout master
$ git checkout abandoned useful.txt