The original poster asks:
Shall I stash, do a pull to get the fix, and continue to work on my feature? and pop the stash when I'm done?
That's one option you have. The other options are as follows:
The original poster asks:
What is the best way to do it for both scenario:
- I have no common files modified with the new file I need?
- I have common file modified (I just want to do a quick local merge basically like with svn)?
If the new file you have is ready to commit, you can just commit it, then do a merge or a rebase. If the file you modified is also modified in the commits you're fetching, it doesn't really matter if you do a merge or a rebase, there's a chance that you might have to resolve conflicts either way:
git commit -am "Commit message here"
git fetch <remote-with-fix>
# Rebase your work on top of fix
git rebase <remote-with-fix>/<branch-with-fix>
# Or do a merge instead
git merge <remote-with-fix>/<branch-with-fix>
If the new file you have is not ready to commit, you could just make a temporary commit, then do a fetch of the fix, then rebase your work on top, then undo the temporary commit with a mixed reset:
git commit -am "Temporary commit"
git fetch <remote-with-fix>
git rebase <remote-with-fix>/<branch-with-fix>
git reset head^