Changing message to already pulled commits
I’ve been working on a project where all commit messages where made in Spanish. Now I’m working with people from other countries so I’d like to change commit messages to English. Is it possible?
- How do I enable cloning over SSH for a Gitlab runner?
- Is there a cleaner way of executing this git workflow?
- SSH Key asks for password
- GitLab - unable to view files after adding folder with files to an existing folder
- gitlab changing project path
- Git - Automatic deployment in live webserver,doesnot show changes in gitlab
One Solution collect form web for “Changing message to already pulled commits”
Yes, you will have to do what is known as an “interactive rebase”. This will allow you to, amongst other things, rewrite the commit message.
git log --topo-order --reverse to find the first commit ID (it will be the first one) then use
git rebase -i to rewrite all the commit messages. It will look something like this.
$ git rebase -i <first commit ID> pick ea21ffd Version 2.13.1 pick b98b956 Allow the extra_compiler_flags option to work. pick d096ee5 Fix "perl5i -e" from segfaulting. ... # Rebase 42c49b0..d096ee5 onto 42c49b0 (3 command(s)) # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # d, drop = remove commit # # These lines can be re-ordered; they are executed from top to bottom.
In your case you’d change every
See Changing Multiple Commit Messages in Pro Git for more information about doing an interactive rebase.
Note that in doing so you don’t rewrite history, you create new history. All the commit IDs will change. Anyone who has the code checked out will get an error when trying to push and pull and have to resync. See The Perils Of Rebasing in the Pro Git book for more information.