--nextPart2515147.jGXJZWHOC5 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Em Segunda-feira 19. Outubro 2009, =C3=A0s 19.14.22, Michael Jansen escreve= u: > > [Except that --strategy=3Dtheirs does not exist; it has to be something > > like=20 > > $ git merge --strategy=3Dours --no-commit 4.7-patched > > $ rm .git/index > > $ git read-tree 4.7-patched > > $ git commit > > $ git status > > $ git reset --hard && git clean -fd > >=20 > > but only for the maintainer of the branch, of course.] > >=20 > > > > > who's going to maintain such a branch, though? >=20 > Do you know why i'm pretty confident i never ever have to work with git in > my daytime job? Every time someone suggests that, i just present these > lines with the question: "Please explain to everyone in this room what > happened there" >=20 > :)) . And i won't except a line like here a wonder happens -> *desired=20 >=20 > result* . You don't have to know what those commands do to use Git. You have to=20 understand only the part between the brackets above: merge strategy "theirs= "=20 doesn't exist. It would be the opposite of strategy "ours" if it did. What Johannes suggested involved knowing Git internals (the .git/index file= and=20 the plumbing command read-tree). You don't have to know that in order to us= e=20 Git. Instead, you just have to understand what "theirs" would mean. Since it's t= he=20 opposite of "ours", all you need to do is invert the merge order. Instead of: git checkout branch git merge -s theirs otherbranch You should do: git checkout -b tmp otherbranch git merge -s ours branch git checkout branch git merge tmp git branch -d tmp This is using only checkout, merge and branch, so you should be able to=20 understand it. Johannes's commands are doing technically the same thing, bu= t=20 are more efficient (they avoid an extra branch switch, which could mean che= cking=20 out thousands of files and trashing your disk cache). > Do you know why i'm scared? Because what you suggested seems to make sense > and thiago understood it. And i thought i finally would make sense of > git.=20 I hadn't even tried to understand the commands until you suggested that I h= ad.=20 They looked unnecessarily complex for what I wanted to do. But now that the= =20 game is on, I could do it even more efficiently, by running: sha1=3D`echo "Updating kde-qt" | \ git commit-tree otherbranch^{tree} -p otherbranch -p branch` git update-ref refs/heads/branch $sha1 Or, also using the amazing git-fast-import: git fast-import --date-format=3Dnow < from refs/heads/otherbranch^0 merge refs/heads/branch^0 EOF But this is just being showoff. Point being: all of Git's internals are=20 exposed, if you want to do things very efficiently for your own scripts. Bu= t you=20 don't have to know the internals to use Git. =2D-=20 Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Senior Product Manager - Nokia, Qt Development Frameworks PGP/GPG: 0x6EF45358; fingerprint: E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358 Qt Developer Days 2009 | Registration Now Open! Munich, Germany: Oct 12 - 14 San Francisco, California: Nov 2 - 4 http://qt.nokia.com/qtdevdays2009 --nextPart2515147.jGXJZWHOC5 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iD8DBQBK3KopM/XwBW70U1gRAgCGAJ97lj1tzInxGaOMKUQLV0Ya616tZgCeN7CU 4E/L8NNT0z1jT6GbQyVdwB8= =2AI0 -----END PGP SIGNATURE----- --nextPart2515147.jGXJZWHOC5--