On Thu, Mar 22, 2012 at 11:24 PM, Christopher Jones < christopher.jo...@oracle.com> wrote:
> 1. I had fun with a couple of small git merges today. I was trying to > use local clones as briefly outlined on irc by dsp. Multiple clones for each branch will be *much **much* harder to manage from a Git POV. >From a build POV though, it might be easier as you can avoid lots of `make clean` etc.. > The goal is to > have different local directories for each of the three branches: > 5.3, 5.4 and 'trunk'. The resulting pushes I made today are a > little strange and need reviewing/reverting. For example my > oci8/README fix doesn't seem to have got merged to 5.3. With multiple local clones, you can end up with some strange situations if you don't know exactly what you're pushing/pulling between them AND the central repo.. > At some stage somehow '21 commits' got merged to PHP 5.4. I swear 'git > diff' was only showing my changes. > Right - `git diff` shows the different between HEAD (The last commit of the branch your are currently on) and what you have yet to commit. So - When you then merge $current_branch into $other_branch, the merge will merge all commits from $current_branch into $other_branch, not just your own.. eg: $ git checkout PHP-5.3 # Edit some files $ git commit .. # Edit some files 2 $ git commit .. $ git checkout PHP-5.4 $ git merge PHP-5.3 2 commits will be merged - Assuming nobody else has changed 5.3 since the last time anyone merged it into 5.4 If on the other hand, someone else committed to 5.3, did not merge to 5.4, and you have that commit in your 5.3 branch.. then the merge will do 3 commits, even though you only made 2. This is likely what you saw. `git log --oneline --graph` is a useful command to try and understand what happened, and what was merged where.. Thanks, Kiall