So I have two tracked branches in my repo, 'testing' and 'master'. These are tracking to the same named branches on my remote server. I have the .gitconfig option for push.default set to 'tracking'. However when I do "git push origin" it merges my new changes with the Master branch ont he remote server. Here is the output of 'git remote show origin':
* remote origin
Fetch URL: git+ssh://******************
Push URL: git+ssh://******************
HEAD branch: master
Remote branches:
master tracked
testing tracked
Local refs configured for 'git push':
master pushes to master (up to date)
testing pushes to testing (fast-forwardable)`
Basically, I want to be able to just type 'git push' and 'git pull' and it will automatically push and pull to origin with the appropriate branch.
EDIT:
[*****]$ git config push.default
tracking
[*****]$ git --version
git version 1.7.3.4
You can change this behavior by editing the "push.default" property.
I always use the "simple" mode which tries to find a remote branch having the same name as your current branch and push to it.
git config --global push.default simple
This is the mode advised for beginners due to his ease of use and safety.
...refuse to push if the upstream branch's name is different from the local one.
Find more in the official doc (end of the page): http://git-scm.com/docs/git-config
git config remote.origin.push HEAD
请参阅git push
的文档(在示例部分的底部)。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.