Agrupe las confirmaciones/mantenga las confirmaciones en privado al enviarlas

I want to keep some commits private on push, so I want that they get bundled into one big commit on the remote side. Locally they should remain splitted.

A use case is for example the work on a static blog. The draft steps should be commited and tracked locally but on push I want only publish released versions.

A solution in git and/or mercurial will be accepted.

preguntado el 28 de agosto de 12 a las 11:08

Why do you want to hide them? What about merging with --no-ff and then only following the first-parent of each commit? -

2 Respuestas

In Mercurial 2.1 and later you can use fases to mark changesets as "secret". This will mark all outgoing changesets as secret:

$ hg phase -f --secret "outgoing()"

A secret changeset is not pushed or pulled by default, so after that command there wont be any outgoing changesets — adjust as needed to mark the right changesets as secret.

You also say you want the changesets as one big commit in the remote repository. For that you can use the histedit extensión bundled with Mercurial 2.3 and later. Use the --keep flag so that it wont remove the original changesets when you collapse them.

Respondido 28 ago 12, 13:08

Nice, +1, I like that "secret" feature: it could have came in handy for stackoverflow.com/questions/12159662/… - VonC

Yeah, it's a nice feature. There is a lot of advanced features coming that build on top of the phase concept, see hg-lab.logilab.org/doc/mutable-history/html - Martín Geisler

The idea would be to make your commits on a dedicated branch, but to git merge --squash ellos en master (or any other public branch you intent to push), since it will produce one big commit.
You would then push master on the remote repo.

Ver "En git, ¿cuál es la diferencia entre merge --squash y rebase?"

contestado el 23 de mayo de 17 a las 13:05

Note: squasing commits in Mercurial: stackoverflow.com/a/1725638/6309. Más generalmente: stackoverflow.com/questions/6937776/… - VonC

I think this is the way to go. Keeping a local branch for each article draft phase and then merge --squash a release version in master. Later I can throw the draft commits away if I don't need them. Will try this in practice and then accept your answer if it works :) - schlamar

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.