I added wrong commit message and pushed to server in Gitlab. Now I want to change commit message. Is it possible to change commit message after pushed to server?
            Asked
            
        
        
            Active
            
        
            Viewed 2.5k times
        
    1 Answers
26
            git commit --amend
When you run this command, it will ask you to change the commit message in a file. After changing it, make sure you push into the correct branch with the following command.
git push -f origin "your branch"
Edit commit message without opening a file:
git commit --amend -m "Your new commit message"
 
    
    
        Mythili
        
- 404
- 4
- 4
- 
                    1Be aware though that you're changing the history of a "public" (possibly already checked out by other users in their local working directory). You *must* therefore have explicit rights to do this. Even if you're the repository owner, you may have to perform some setup operation to turn this on. – Obsidian Sep 04 '18 at 12:17
- 
                    1@Obsidian: Agreed! – Mythili Mar 03 '19 at 13:27
