From: "\"Peter Valdemar Mørch (Lists)\"" <4ux6as402@sneakemail.com>
To: git@vger.kernel.org
Subject: git merge --squash isn't "marked as a merge"??
Date: Tue, 29 Jul 2008 09:49:29 +0200 [thread overview]
Message-ID: <488ECB89.5060801@sneakemail.com> (raw)
Newbie alert:
I have a feature branch where I have N tiny commits with sloppy/private
commit messages. Being able to have private commits was the main reason
I'm using git (as a frontend to svn).
Today the feature is in a "good" state, and I want to merge it into a
main branch, showing a single commit with a well phrased message for all
the world to see. So I:
$ git checkout master
$ git merge --squash feature
$ git commit -F wellphrased.msg
Now I was expecting that:
$ git merge feature
would do nothing (I already did a merge!). But it pulls in all the
sloppy commits and messages from "feature"!
Of course now I could continue with a new branch made like this:
$ git checkout -b feature2 master
and continue working privately on feature2 again. Then I'll end up with
feature..feature47 before I'm done. Each with its own segment of my
private history. A real mess.
Can I continue on feature somehow so I privately can "git log" and
see all my messy commits (both before and after the "git merge
--squash") and then regularly "git merge" and/or "git merge --squash"
back and forth between "feature" and "master" as I deem appropriate?
I'm guessing that if the --squash *did* put in a "merge arrow" (setting
a "parent" of the commit to the head of feature) thereby allowing merge
to not do anything, then git log would also follow feature's sloppy
history too. They go together as a pair. Is that right? Testing this:
git help merge says about --squash:
> Produce the working tree and index state as if a real merge happened,
> but do not actually make a commit or move the HEAD, nor record
> $GIT_DIR/MERGE_HEAD to cause the next git commit command to create a
> merge commit.
So I tried "git merge --squash feature", then set up .git/MERGE_HEAD to
the same contents as .git/refs/heads/feature and then "git commit". This
produced the same result as "git merge" without --squash including all
the sloppy messages.
SO: It seems to me I cannot continuously merge "feature" to "master" in
chunks with "--squash" as I would like. Is that right? Is my desire
fundamentally misguided, and is there A Better Way?
Peter
--
Peter Valdemar Mørch
http://www.morch.com
next reply other threads:[~2008-07-29 7:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-29 7:49 "Peter Valdemar Mørch (Lists)" [this message]
2008-07-29 8:53 ` git merge --squash isn't "marked as a merge"?? Junio C Hamano
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=488ECB89.5060801@sneakemail.com \
--to=4ux6as402@sneakemail.com \
--cc=git@vger.kernel.org \
/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