I used to have my git set up very nicely where it would automatically push to the remote branch with the same name when I ran git push
, and automatically pull when running git pull
.
I tried to show a friend how to do this and in the process managed to break my own config. How can I get back to the functionality I'm looking for? I've tried a bunch of configs, but each has its problems.
I currently have this in ~/.gitconfig
:
[push]
default = current
[branch]
autoSetupMerge = always
But when I create a new branch locally, then commit and push, it says "Everything up-to-date". If I then run git push origin <branch_name>
it does push the changes.
These settings don't seem to do the trick either:
[push]
default = matching
[branch]
autoSetupMerge = always
You can use following command to instruct git to by default create remote branch with same name (I have used global level, you can decide level based on your requirement:
git config --global push.default current
source
you can use -u option for first time push for new branch, it will help in tracking of new branch and will help while pulling changes. If you did not use -u for first time push, you can use it for later push also. Basically, tracking will start after a push with -u option.
git push -u
without specifying origin and branch name for new branch and push changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With