Delete commited messages from Gerrit server

27 views
Skip to first unread message

Brijesh Somu

unread,
Jul 9, 2015, 6:47:35 AM7/9/15
to repo-d...@googlegroups.com
Hi Guys, some immediate help needed to remove commits from my Gerrit server.

We were adding a 3rd party code with previous git history changes to our gerrit. This has resulted in 900+ commit messages.

I dont want all these commits now, pls suggest how i can delete all these permanently from the server.

I am using the h2 database.

Thanks
Brijesh

Alex Blewitt

unread,
Jul 9, 2015, 8:03:59 AM7/9/15
to Brijesh Somu, repo-d...@googlegroups.com
If you don't want the commits you'll have to do some surgery. If you don't want the reviews you could just mark all of them as abandoned. 

To remove the commits you'd need to delete the review rows from the database but I don't know if this will leave a hole between change ids and wether that will cause problems. You'd also need to delete the refs/changes/ references as well after which a git gc will get rid of the references. 

Suggest you take a backup of the db and repository and lock down the project for any new reviews to allow you to clean up properly. 

Alex

Sent from my iPhat 6
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Oswald Buddenhagen

unread,
Jul 9, 2015, 2:02:10 PM7/9/15
to repo-d...@googlegroups.com
On Thu, Jul 09, 2015 at 03:47:35AM -0700, Brijesh Somu wrote:
> We were adding a 3rd party code with previous git history changes to our
> gerrit. This has resulted in 900+ commit messages.
>
the smartness of pushing to refs/for/branch instead of branch while not
having the server configured to require change-ids in commits uploaded
for review (unless that imported history came from another gerrit, in
which case this cheap protection wouldn't have helped anyway). ;)

> I dont want all these commits now, pls suggest how i can delete all these
> permanently from the server.
>
you could use the force-draft plugin to turn all these changes into
drafts, which you can then delete (you can script that via the REST
api).

> I am using the h2 database.
>
that's not relevant for the suggested approach.
well, in fact, it probably isn't relevant even if you choose to hack the
database manually, as the gsql interface abstracts that mostly.
Reply all
Reply to author
Forward
0 new messages