Wednesday, December 16, 2015

Edit an incorrect commit message in Git

Edit an incorrect commit message in Git

Amending the commit message

git commit --amend
Will open your editor, allowing you to change the commit message of the most recent commit. Additionally, you can set the commit message directly in the command line with:

git commit --amend -m "New commit message"


Make sure you don't have any working copy changes staged before doing this or they will get committed too. (Unstaged changes will not get committed.)

Changing the message of a commit that you've already pushed to your remote branch

If you've already pushed your commit up to your remote branch, then you'll need to force push the commit with

git push <remote> <branch> --force
# Or
git push <remote> <branch> -f
Warning: force-pushing will overwrite the remote branch with the state of your local one. If there are commits on the remote branch that you don't have in your local branch, you will lose those commits.
Warning: be cautious about amending commits that you have already shared with other people. Amending commits essentially rewrites them to have different SHA IDs, which poses a problem if other people have copies of the old commit that you've rewritten. Anyone who has a copy of the old commit will need to re-synchronize their work with your newly re-written commit, which can sometimes be difficult, so make sure you coordinate with others when attempting to rewrite shared commit history, or just avoid rewriting shared commits altogether.



  1. There are numerous new tools and applications used in order to make way for faster and better programming.
    php development company sydney

  2. Custom web development is the most effective way to build a creative website with stunning design. would like to appreciate your work. Thank you so much for sharing.

  3. PHP Training in chennai
    Creating Experts provide Real Time scenarios PHP training in Chennai.At creating experts the trainers have around 8+ years of experience.They teach the advance level topics by giving real time examples.
    Contact us: 8122241286, 9003085882 – Karthick
    Here everything is practical basis not any classroom training.The trainers are working in mnc's and they will take classes only on Saturday and Sunday.
    Ref link :

  4. Thanks for sharing this Information, Got to learn new things from your Blog on PHP.
    Ref link :


  5. Thanks for the great information in your blog PHP

  6. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about PHP.

  7. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about php


  8. ever best friendly advertising networks find having over 10000 worldwide ad networks find Ad network cpm cpc cpi cpa

  9. Blogs are so informative where we get lots of information on any topic. Nice job keep it up!! training in jalandhar

  10. Thanks a lot for your valuable article. I will keep following your blog for more information.

  11. My friend Suggest me this blog and I can say this is the best blog to get the basic knowledge.Thank you so much for this Selenium Training in Chennai

  12. Thanks for sharing this Information, Got to learn new things from your Blog on Appium.
    Appium training in chennai

  13. Nice idea. Brief and well written; keep it up

  14. It was very nice blog to learn about Selenium.Thanks for sharing new things.selenium training in chennai

  15. Nice info about Php it’s reallyhelpful…. If it possible share some more tutorials……….


  16. I have seen lot blogs and Information on othersites But in this PHP Blog Information is very useful thanks for sharing it........

  17. Australia Best Tutor is one of the best Online Assignment Help providers at an affordable price. Here All Learners or Students are getting best quality assignment help with reference and styles formatting.

    Visit us for more Information

    Australia Best Tutor
    Sydney, NSW, Australia
    Call @ +61-730-407-305
    Live Chat @

    Our Services

    Online assignment help
    my assignment help Student
    Assignment help Student
    help with assignment Student
    Students instant assignment help
    Students Assignment help Services

  18. Each department of CAD have specific programmes which, while completed could provide you with a recognisable qualification that could assist you get a job in anything design enterprise which you would really like.

    AutoCAD training in Noida

    AutoCAD training institute in Noida

    Best AutoCAD training institute in Noida

  19. 6-week summer course in Noida - 6 weeks The summer course plays a crucial role in shaping the career of young aspiring / informatics students. This training has been specifically introduced so that students can become familiar with current industrial culture and industrial needs. Webtrackker technology offers a 6-month training program for students / graduates that includes small and large projects.
    6-week summer course in Noida


Related Posts Plugin for WordPress, Blogger...