git merge --squash isn't "marked as a merge"??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux