On Thu, Feb 3, 2011 at 4:10 AM, Stefan Majewsky <stefan.majew...@googlemail.com> wrote: > On Thu, Feb 3, 2011 at 6:21 AM, Dawit A <ada...@kde.org> wrote: >> git config --global push.default tracking >> >> and use the -t or --track option when creating your branches (branch >> or checkout -b). This way you can 'git push' (no arguments) in the >> current tracked branch without accidentally pushing your changes in >> other branches. > > I think this is the default. When I do "git checkout -b somework > origin/somework" here, it automatically sets up somework to track > origin/somework.
Right, but only for a remote branch. > Push by default only operates on the tracking branch, > i.e. push --all needs to be specified manually. Well that is exactly what I assumed, but it turned out not to be the case. See "push.default" in git-config man page. By default it operates on all "matching" branches not just the current branch. Unless you change the push default, you end up with the problem I had where all the changes in my local master branch where pushed into remote master when I only meant to push a fix from my local 4.6 branch to the remote 4.6 branch. Of course, if I had issued "git push origin HEAD:<branch>" instead, I would not have screwed up, but I did not. Hence this heads up. Change the default push behavior in your config to avoid making the same mistake I did...