Git acts as you described, because you have the following situation:
- You have a local branch (hotfix112) that tracks the remote branch with different names.
- do you have push.default option for matching (default) or simple
As usual with git, you have several alternatives on how to configure git to act as desired:
1.) The easiest way would be to change the name of your local branch to match the name of the remote branch. After that, pressing starts to work automatically. So just rename the "hotfix112" branches to "hotfix / 1.1.2":
git branch -m hotfix112 hotfix/1.1.2
2.) You can change the behavior of the push by setting the push.default option to "track". Since you already have a "hotfix112" branch, to track the source code / patch / 1.1.2, pressing the git button will work as desired. To set the local git option:
git config --local push.default tracking
3.) You can manually edit the .git / config file and set push to match the local refspec 'hotfix112' to the remote 'fix / 1.1.2'. You must add a push line below the [remote "origin"] section:
[remote "origin"] url = ... fetch = ... push = hotfix112:hotfix/1.1.2
The first and third approaches work only in the hotfix112 branch. The second one works for all tracking branches in this repository (or globally if the global option is used).
source share