Modified files in a git branch are spilling over into another branch

Solution 1:

Why is that the file is shown as modified in master branch even though it was modified in git-build branch?

The key to remember is that the file was not modified in the git-build branch. It was only modified in your working copy.

Only when you commit are the changes put back into whichever branch you have checked out

Solution 2:

If you want to temporarily store your changes to one branch while you go off to do work on another, you can use the git stash command. It's one of the amazing little unsung perks of using git. Example workflow:

git stash #work saved
git checkout master
#edit files
git commit
git checkout git-build
git stash apply #restore earlier work

git stash stores a stack of changes, so you can safely store multiple checkpoints. You can also give them names/descriptions. Full usage info here.