r/github • u/antm0303 • Apr 03 '24
Is it possible to change commit messages?
I have some old commits, and they look a little unprofessional. Is there any way to change them? It’s quite funny, but in the event other people contribute to my code I’d like it to look a little better.
151
u/Noch_ein_Kamel Apr 03 '24
What makes git better than real life is that you can rewrite history. https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History
Unless you told anyone else about it (git push) and they won't forget... Then you have to force it upon them.
50
u/drcforbin Apr 03 '24
But if others already heard about it (git pull) it's up to them whether to accept your new reality
14
u/Key_Direction7221 Apr 03 '24
Yep, history is no longer immutable in git. There are pros and cons to this “feature”.
5
1
u/Key_Direction7221 Apr 03 '24
Yes, there’s a way to do it where the entire history is essentially rebuilt without the comment. I don’t remember the utility’s name but it’s on GitHub.
21
u/RoseSec_ Apr 03 '24
They say code riddled with language shows passion and is generally better in quality 😂
32
11
u/GilletteSRK Apr 04 '24
I recall reading that the more swearing in commit messages there is, the higher quality the code is.
6
4
u/notNezter Apr 04 '24
I work in software configuration management. You have my vote to leave the original message!
4
2
u/joe630 Apr 04 '24
As someone that regularly looked at candidates repos as part of interviews, this would only help you at any company you would actually want to work at.
2
u/sebastiankolind Apr 04 '24
Honestly, don’t worry about it. Everybody has commits like these once in a while.
2
2
Apr 07 '24
"this will never work"
"this is shit"
"blah blah fuck you"
"I am a gigantic idiot"
Mine looks like that.
Keep yours!
I
1
1
-20
u/bdzer0 Apr 03 '24
wrong sub.. r/git this isn't anything GitHub specific.
That said, sure.. you can revise commit messages however there are many pitfalls..
12
u/antm0303 Apr 03 '24
Ah okay sounds good. I was asking here because I didn’t know if there was any way at it through GitHub or not.
-4
Apr 03 '24
[removed] — view removed comment
8
u/antm0303 Apr 03 '24
I did google, thank you. I wasn’t sure if there was an easier way.
7
u/sirdunlap Apr 04 '24
I mean, also this is funny and that person is a wet blanket.
-3
Apr 04 '24
[removed] — view removed comment
2
u/antm0303 Apr 04 '24
Oh give me a break lmao. Yeah head back to Mensa, we’re clearly too stupid for your prime intellect.
-1
u/georgehank2nd Apr 04 '24
So you want to fake professional looking commit messages… because you're obviously still an unprofessional person.
2
u/antm0303 Apr 04 '24
I should say I want them to be more appropriate, not professional. But yes, I can be unprofessional, and it’s not a big deal as long as it’s in the right setting.
-2
9
u/notParticularlyAnony Apr 04 '24
This isn’t stack overflow ffs
-1
1
u/serverhorror Apr 07 '24
I visit these posts purely for entertainment, stop commenting if you don't care.
Or rather don't, these comments ate part if my entertainment


49
u/SoCalChrisW Apr 03 '24
You're looking for the git amend command. You can change all sorts of things with a previous commit using that, including commit messages, the committer, even the commit itself.