Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amend previous commit with no change to commit message

I had already pushed some changes to a remote. Now I need to push some other changes which should be in that previously pushed commit but somehow are not. I can do this simply by pushing the changes with a new commit but just now I have found the --no-edit flag and --amend

If I need to push the new changes but I need a single commit having the old and new changes is git commit --amend --no-edit going to achieve that?

like image 913
Piyush Chaudhary Avatar asked Sep 12 '26 22:09

Piyush Chaudhary


1 Answers

Yes, the git commit --amend --no-edit is the thing that I am looking for.

  1. git add . (Add the added and modified files)
  2. git commit --amend --no-edit
  3. git push --force-with-lease <remote> <branch>
like image 84
Piyush Chaudhary Avatar answered Sep 14 '26 14:09

Piyush Chaudhary