From: Paolo Bonzini <bonzini@gnu.org>
To: seanh <seanh.nospam@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Using git to track my PhD thesis, couple of questions
Date: Fri, 28 Aug 2009 17:50:28 +0200 [thread overview]
Message-ID: <4A97FCC4.5070808@gnu.org> (raw)
In-Reply-To: <20090828133708.GA11146@kisimul>
On 08/28/2009 03:37 PM, seanh wrote:
> In response to Matthieu and Paolo, I'm not sure I understand the git
> internals involved in the discussion around merge --squash, I had a
> feeling this would produce a 'merge' that git in some sense would 'not
> know about', since it sounds complex and I don't understand it I don't
> think I want to go there.
Yes, the problem is that git does not track what happens when you do
"git merge --squash", which makes it harder to do merges after some time
(because of conflicts).
The solution I gave (and Matthieu explained how it works, even though
it's very technical) is a way to "explain" git what you did. If you try
it on a fake example with gitk, you should understand it better.
mkdir test
cd test
# import
git init
echo a > test
git add a
git commit -m1
# some changes happen in your local "fine grained" branch
git checkout -b local
echo b > test
git commit -a -m2
echo c >> test
git commit -a -m3 ##<<<
# the magic incantation brings those commit to master
# (first two commands) and teaches git what happened (last two)
git checkout master
git merge --squash local; git commit -m'merge 1' ##<<<
git checkout local
git merge master ##<<<
# more local changes
sed -i s/b/d/ test
git commit -a -m4
echo z >> test
git commit -a -m5 ##<<<
# the magic incantation, again
git checkout master
git merge --squash local; git commit -m'merge 1' ##<<<
git checkout local
git merge master ##<<<
Use gitk at the points indicated with ##<<<
It is actually very similar to what you chose to do. My commits to
master, in practice, are your tags. You may want to see how gitk's
graphs looks in both scenarios, and choose the one that you prefer.
Hope this helps!
Paolo
next prev parent reply other threads:[~2009-08-28 15:50 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-27 20:34 Using git to track my PhD thesis, couple of questions seanh
2009-08-27 20:41 ` Sverre Rabbelier
2009-08-27 20:55 ` Matthieu Moy
2009-08-28 8:34 ` Paolo Bonzini
2009-08-28 8:46 ` Matthieu Moy
2009-08-28 13:37 ` seanh
2009-08-28 13:51 ` Matthieu Moy
2009-08-28 13:54 ` Matthias Andree
2009-08-28 15:12 ` Merging in Subversion 1.5 (was: Re: Using git to track my PhD thesis, couple of questions) Jakub Narebski
2009-08-28 15:29 ` Avery Pennarun
2009-08-28 15:44 ` Matthias Andree
2009-08-28 16:19 ` Merging in Subversion 1.5 Jakub Narebski
2009-08-28 16:28 ` Matthias Andree
2009-08-28 16:34 ` Avery Pennarun
2009-08-30 19:41 ` Merging in Subversion 1.5 (was: Re: Using git to track my PhD thesis, couple of questions) Sam Vilain
2009-08-31 5:47 ` Dmitry Potapov
2009-08-28 21:42 ` Using git to track my PhD thesis, couple of questions david
2009-08-28 15:50 ` Paolo Bonzini [this message]
2009-08-28 16:12 ` demerphq
2009-08-28 21:44 ` david
2009-08-28 22:16 ` demerphq
2009-08-27 21:38 ` Junio C Hamano
2009-08-27 22:21 ` demerphq
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A97FCC4.5070808@gnu.org \
--to=bonzini@gnu.org \
--cc=git@vger.kernel.org \
--cc=seanh.nospam@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).