Git development
 help / color / mirror / Atom feed
* git merge --squash isn't "marked as a merge"??
@ 2008-07-29  7:49 "Peter Valdemar Mørch (Lists)"
  2008-07-29  8:53 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: "Peter Valdemar Mørch (Lists)" @ 2008-07-29  7:49 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-29  8:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-29  7:49 git merge --squash isn't "marked as a merge"?? "Peter Valdemar Mørch (Lists)"
2008-07-29  8:53 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox