Reputation: 10320
On my local machine, I have a repository set up as the following
* remote origin
Fetch URL: [email protected]:me/my_project.git
Push URL: [email protected]:me/my_project.git
HEAD branch: master
Remote branches:
mac-master tracked
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (local out of date)
There is only master
branch locally, and I want to always push my local master to the remote mac-master
branch. Should I just do:
git push origin master:mac-master
every time I need to push? If not, what is the correct way of doing it?
Upvotes: 3
Views: 2863
Reputation: 47603
You can change the branch on the remote that your branch is tracking by:
git branch --set-upstream branch_name your_remote/other_branch_name
This way, pushes of branch_name
to your_remote
will be done to other_branch_name
.
Upvotes: 5
Reputation: 411340
If you always want to do it, run
$ git push -u remote master:mac-master
once. The -u
flag will set up options so that subsequently you can do:
$ git push
to push master
to mac-master
on remote
.
Upvotes: 6