Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Change the commit message of my last commit

    Juri StrumpflohnerJuri Strumpflohner

    Did you make a typo in your last commit message? No problem, we can use the git --amend command to change it very easily. Note: This only holds if you did not yet push your changes to the remote repository



    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson




    Instructor: On my local master branch here, I made a change to our Readme file. I just added a couple of lines. We want to commit them.

    We do usually git add. We do the git commit -m add credit section. Before we just put it up on to our remote repository, we recognize that we actually made a mistake. Let's say we have a normal naming convention that in front of every commit we use what type of contribution it is.

    However, we have already committed that to our local master branch and we want to change inaudible commit message. What we can do is to simply use the git commit --amend command. If I hit enter, I am going into that editing mode again, and I can just adhere the line. Save again.

    Now you can see that the commit message has been changed. It's very important to note here that we shouldn't do that whenever we have already synchronized the change with the remote repository because, again, we are changing here the ID of our commit. Therefore, we will break again the merges with inaudible people.