When I develop on a branch at some point before the Pull Request I do:
$> git checkout myBranch
$> git pull
$> git rebase origin/master
# fix conflicts and --continue
$> git push --force
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
Counting objects: 21, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 1.59 KiB | 0 bytes/s, done.
Total 11 (delta 8), reused 0 (delta 0)
To [email protected]:bar/foo.git
+ 64f1387...ed6f9be myBranch -> myBranch (forced update)
+ ccaadf5...42e0c8d master -> master (forced update)
The problem here is the last line, a force push to master. This shouldn't have happend, I only wanted to force push to myBranch. But thats not all, the force push to master results in a master branch which now misses the last couple of commits. Which, I think, is weird, because I just did a pull. Can someone explain to me what just happend ?
I think the cure is to do
$> git config --global push.default simple
and/or
$> git push --force origin/myBranch