Amend

PROBLEM SITUATION :

  • You did your functionality in a branch, thinking about everything, right after that you add in git and commita, perfect! However, afterwards, you remember that you forgot to delete the comments you had made, THAT IS HOW YOU ENTER <git commit --amend>
$ git commit --amend

Note: ammend, makes you take the last commit in your story and put it together, so you wouldn't need to commit again, you would use the last commit.

There are a few ways to ammend:

CHANGE MESSAGE:

  • The terminal will open vim to change the commit
$ git commit --amend

DO NOT CHANGE

  • No need write anything
$ git commit --amend --no-edit

WRITE NEW MESSAGE

  • write the commit
$ git commit --amend -m "message"

 

IMPORTANT TIPS:

  • Only do this when you think the last commit in history is YOUR .
  • Only do it for small changes , if you are going to write a new feature, make another commit.
  • If the commit message is ugly, you can use this command to improve it.
  • To send to the remote repository, you will need to force the push .

results matching ""

    No results matching ""