Basic question but this happens to me all the time:
working-branch
master
git merg
Get in the habit of typing $ git status
before you actually do a git command that will modify something.
Given that, you have probably edited your file but not checked it in, because you would run git status
before the commit. In this case, git does the right thing if you just switch branches, then commit.
If you have fired a commit off to master, then just move the file between branches with something like this:
$ git checkout --patch master
You don't really have to reset master if you are just going to merge the same file with it, but since presumably you haven't pushed anything yet you should just reset to your remote tracking branches...
$ git reset master origin/master
$ git reset stage origin/stage # whatever