Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I delete(or hide) a git commit from Sourceforge?

I have a project to which I commit almost daily and I would like to delete a commit from around 4 days ago, so that it would appear that the commit after that one was made immediately after the commit before it. The problem is a silly comment that is not very professional and that I wouldn't like to be seen (but now it can be seen very clearly with the diff feature of Sourceforge).

like image 369
Ioana Avatar asked Jan 31 '26 16:01

Ioana


1 Answers

If the change has already been pushed (i.e. not in your local branch) then you might want to just forget about it. Because git is a distributed software configuration management tool, others may have pulled your changes and could potentially revert anything you try and undo. From the linked question above it is explained rather well:

However, if others may have pulled it, then you would be better off starting a new branch. Because when they pull, it will just merge it into their work, and you will get it pushed back up again.

If you already pushed, it may be better to use git revert, to create a "mirror image" commit that will undo the changes. However, both commits will both be in the log.

In general, making deletions on origin/master kind of goes against the whole idea of source control. You should be tracking all code, the good & bad.

like image 105
Magikhead Avatar answered Feb 02 '26 06:02

Magikhead



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!