12 Days of Baddass Courses sale! Get instant access to the entire egghead library of courses and lessons for 58% off.

Runs out in:
13 : 08 : 55 : 50
Join egghead, unlock knowledge.

Want more egghead? It's 58% off for a limited time only!

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

Unlock All Content for 40% Off
Become a member
to unlock all features

    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.