Git has 2 forms of branches: local and remote. To use git pull and git push as you want, you have got to tell your local branch (say, my_test) which remote branch it's tracking.
In typical git fashion, this will be done in both the config file and with commands.
Commands
Make sure you're on your master branch with
1)git checkout master
then create the new branch with
2)git branch --track my_test origin/my_test
and check it out with
3)git checkout my_test.
You can then push and pull while not specifying which local and remote.
However if you have already created the branch then you'll use the -u switch to inform git's push and pull you'd like to use the required local and remote branches
from now on, like so:
git pull -u my_test origin/my_test
git push -u my_test origin/my_test
Config
The commands to setup remote branch tracking are fairly straight forward but I'm listing the config way as well as I find it easier if I'm setting up a bunch of tracking branches.
Using your favorite editor open up your project's .git/config and add the subsequent to the bottom.
[remote "origin"]
url = [email protected]:username/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "my_test"]
remote = origin
merge = refs/heads/my_test
This specifies a remote called origin, in this case a GitHub style one, and then tells the branch my_test to use it as it's remote.