git pull origin master pulls the master branch from the remote called origin into your current branch. It only affects your current branch, not your local master branch.
It’ll give you history looking something like this:
- x - x - x - x (develop) \ / x - x - x (origin/master)
Your local master branch is irrelevant in this.
git pull is essentially a combination of
git fetch and
git merge; it fetches the remote branch then merges it into your current branch. It’s a merge like any other; it doesn’t do anything magical.
If you want to update your local master branch, you have no choice but to check it out. It’s impossible to merge into a branch that’s not checked out, because Git needs a work tree in order to perform the merge. (In particular, it’s absolutely necessary in order to report merge conflicts and allow you to resolve them.)
If you happen to know that pulling into master would be a fast-forward (i.e. you have no commits in your local master branch that aren’t in origin’s master) you can work around, as described in this answer.