Merge two changesets?

815 views
Skip to first unread message

Jeffery Fernandez

unread,
Sep 14, 2011, 9:31:13 PM9/14/11
to repo-d...@googlegroups.com

Hi all,

My committers keep forgetting to do a "git commit --amend" and therefore a new changeset is created with dependency to the previous changeset. Is it possible to merge two changesets? 

Martin Fick

unread,
Sep 14, 2011, 10:01:28 PM9/14/11
to repo-d...@googlegroups.com
No merge option yet. You should look into installing the changeid hook and perhaps enabling the option which makes changeids required.

Jeffery Fernandez <jefferyf...@gmail.com> wrote:

Hi all,

My committers keep forgetting to do a "git commit --amend" and therefore a new changeset is created with dependency to the previous changeset. Is it possible to merge two changesets? 

Matthias Sohn

unread,
Sep 15, 2011, 1:29:07 AM9/15/11
to repo-d...@googlegroups.com
2011/9/15 Jeffery Fernandez <jefferyf...@gmail.com>

Hi all,

My committers keep forgetting to do a "git commit --amend" and therefore a new changeset is created with dependency to the previous changeset. Is it possible to merge two changesets? 

Not in Gerrit but only the hard way by squashing the two commits which led to two
changesets in Gerrit:

- squash the second commit into the first one
- put the first changeset's change-id into the commit message
- re-push it to Gerrit 
- then abandon the second change.

--
Matthias

Johan Björk

unread,
Sep 15, 2011, 3:26:17 AM9/15/11
to Matthias Sohn, repo-d...@googlegroups.com
It would be quite neat to allow gerrit to merge two changesets that depend on eachother from the UI. Anyone looked into the possibility of doing that?

/Johan


Alex Blewitt

unread,
Sep 15, 2011, 4:19:08 AM9/15/11
to Johan Björk, Matthias Sohn, repo-d...@googlegroups.com
On 15 Sep 2011, at 08:26, Johan Björk <p...@spotify.com> wrote:

> It would be quite neat to allow gerrit to merge two changesets that depend on eachother from the UI. Anyone looked into the possibility of doing that?

The problem is that the newly merged change would have a new commit id, and the person who pushed the changes would then have to rebase to do any further work. In essence, you're making it more difficult for them.

It's better (and easier) to prohibit pushes without a change id since it's a one time fix that solves the problem for ever instead of requiring manual intervention each time.

Alex

Sent from my iPod

Jeffery Fernandez

unread,
Sep 16, 2011, 12:18:50 AM9/16/11
to repo-d...@googlegroups.com
Currently, Change-Id is required for the project. If you do "git commit" instead of "git commit --amend", a new changeId is fetched from Gerrit (via the hook), thereby a new change-set being created.

R. Tyler Croy

unread,
Sep 16, 2011, 6:38:19 PM9/16/11
to repo-d...@googlegroups.com

Just to clarify, the commit-msg hook doesn't hit Gerrit at all. IIRC it
prepends the SHA-1 with an "I" and that's it :)


- R. Tyler Croy
--------------------------------------
Code: http://github.com/rtyler
Chatter: http://identi.ca/agentdero
http://twitter.com/agentdero

Reply all
Reply to author
Forward
0 new messages