Possibility to delete last commit in gui #7461

Closed
opened 2025-11-02 07:26:29 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @TimerWolf on GitHub (Jun 14, 2021).

  • Gitea version (or commit ref): 1.14.0
  • Git version: 2.17.1
  • Operating system: Ubuntu 18.04.5 LTS
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
    • Irrelevant
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Irrelevant
  • Log gist:
    • Irrelevant

Description

Sometimes it very easy to manage the code inside the gui on the web and not use the local git with the cli.

I have found this feature very useful but know and then some of the commits that is made have some missing stuff in it typos etc that i would like to correct before i actually make the "real commit" but as we all know the human factor will always be there and it can not be perfect every time.

As it is today i have to go in to the local repo and update it with the remote and then make "git reset HEAD^ && git push --force" to delete the last commit and redo it.

Why is this not possible in the gui?

To delete the last commit, fix typos and other easy stuff and just do the "new real intended commit" to correct it fast and easy.

My opinion that it just make unnecessary spam and a commit log that is more harder to read then it actually has to be.

And as a final comment, if it can be done in the cli why would it not be possible in the gui?

Originally created by @TimerWolf on GitHub (Jun 14, 2021). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq) 5. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.14.0 - Git version: 2.17.1 - Operating system: Ubuntu 18.04.5 LTS <!-- Please include information on whether you built gitea yourself, used one of our downloads or are using some other package --> <!-- Please also tell us how you are running gitea, e.g. if it is being run from docker, a command-line, systemd etc. ---> <!-- If you are using a package or systemd tell us what distribution you are using --> - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - [x] Irrelevant - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Irrelevant - Log gist: - [x] Irrelevant <!-- It really is important to provide pertinent logs --> <!-- Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems --> <!-- In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini --> ## Description <!-- If using a proxy or a CDN (e.g. CloudFlare) in front of gitea, please disable the proxy/CDN fully and connect to gitea directly to confirm the issue still persists without those services. --> Sometimes it very easy to manage the code inside the gui on the web and not use the local git with the cli. I have found this feature very useful but know and then some of the commits that is made have some missing stuff in it typos etc that i would like to correct before i actually make the "real commit" but as we all know the human factor will always be there and it can not be perfect every time. As it is today i have to go in to the local repo and update it with the remote and then make "git reset HEAD^ && git push --force" to delete the last commit and redo it. Why is this not possible in the gui? To delete the last commit, fix typos and other easy stuff and just do the "new real intended commit" to correct it fast and easy. My opinion that it just make unnecessary spam and a commit log that is more harder to read then it actually has to be. And as a final comment, if it can be done in the cli why would it not be possible in the gui?
GiteaMirror added the type/proposal label 2025-11-02 07:26:29 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Apr 14, 2022):

It's a management problem.

If you delete a commit on UI, the user with this commit can still push it again.

The only way to make the repo correct is making users repo correct first, the UI won't help.

@wxiaoguang commented on GitHub (Apr 14, 2022): It's a management problem. If you delete a commit on UI, the user with this commit can still push it again. The only way to make the repo correct is making users repo correct first, the UI won't help.
Author
Owner

@bilogic commented on GitHub (Feb 11, 2023):

I think the OP's question is more about: how can a wrong commit can be wiped out so that it doesn't take up storage on the server.

Imagine an accident happens and 500MB was committed into the repository. This was re-committed with the large files being moved into the LFS. However, the git repository will now take up 1GB until the orphaned commit was removed.

I wasn't able to shrink the size. What I did was

  1. Clone the repo and ran
git reflog expire --expire=now --all
git gc --prune=all --aggressive
  1. Delete and recreate the gitea repository
  2. Push from local again

An easier way to recover the storage would be helpful. Thank you.

@bilogic commented on GitHub (Feb 11, 2023): I think the OP's question is more about: how can a wrong commit can be wiped out so that it doesn't take up storage on the server. Imagine an accident happens and 500MB was committed into the repository. This was re-committed with the large files being moved into the LFS. However, the git repository will now take up 1GB until the orphaned commit was removed. I wasn't able to shrink the size. What I did was 1. Clone the repo and ran ``` git reflog expire --expire=now --all git gc --prune=all --aggressive ``` 2. Delete and recreate the gitea repository 3. Push from local again An easier way to recover the storage would be helpful. Thank you.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7461