Q:

Prevent merge at git pull

Sometimes I type accidentaly the wrong branch name, when I do "git pull origin BRANCH".

Is there a way to forbid "git pull origin XXX" when XXX is not the same branch I have currently checked on my local repository? i.e. allow "git pull" only if the local-checked branch is XXX and not YYY.
That is, I do want "merge" to hapen, but only if I pull the same branch I have currently checked in my local repository. Is there a way I can configurate the local repository to allow "git pull" only from the same branch-name? 
For example:
Case 1: 
Current checked branch on local repository is "test"
[* test ] /code$ git pull origin master

This merges the code from "test"-branch to my local "master" branch. ==> I want to forbid this.
Case 2: 
Current checked branch on local repository is "master"
[* master ] /code$ git pull origin master

This merges the changes from remote "master" branch to my local "master" branch. ==> This
is ok.
I hope I explained my problem well.
Thanks in advance.

A:

You should use git fetch
which does the following: 

Fetches all the objects from the remote repository that are not
  present in the local one.

EDIT:
What is the difference between 'git pull' and 'git fetch'? ("git pull does a git fetch followed by a git merge")
EDIT 2:
AFAIK you can't forbid to pull into a branch since it can be locally name and be whatever whenever. 
But you can change the project to the very last commit before the pull by using
git pull --abort didn't check it should be something like this.
One more thing you can do is git checkout to the SHA1 of the branch before the you made the git pull.
Remember you can always undo all by (irreversible):
git clean -fd
git reset HEAD --hard

