Skip to main content
added 6 characters in body
Source Link
kenorb
  • 168.7k
  • 95
  • 712
  • 796

You can do below to undo your “git commit —amend”git commit —amend

  1. $ git reset --soft HEAD^git reset --soft HEAD^
  2. $ git checkout files_from_old_commit_on_branchgit checkout files_from_old_commit_on_branch
  3. $ git pull origin your_branch_namegit pull origin your_branch_name

====================================

Now your changes are as per previous. So you are done with the undo for “git commit —amend” Nowgit commit —amend

Now you can do “git push origin <your_branch_name> “git push origin <your_branch_name>, to push to the branch.

You can do below to undo your “git commit —amend”

  1. $ git reset --soft HEAD^
  2. $ git checkout files_from_old_commit_on_branch
  3. $ git pull origin your_branch_name

====================================

Now your changes are as per previous. So you are done with the undo for “git commit —amend” Now you can do “git push origin <your_branch_name> “, to push to branch

You can do below to undo your git commit —amend

  1. git reset --soft HEAD^
  2. git checkout files_from_old_commit_on_branch
  3. git pull origin your_branch_name

====================================

Now your changes are as per previous. So you are done with the undo for git commit —amend

Now you can do git push origin <your_branch_name>, to push to the branch.

Source Link
Pratik
  • 696
  • 7
  • 9

You can do below to undo your “git commit —amend”

  1. $ git reset --soft HEAD^
  2. $ git checkout files_from_old_commit_on_branch
  3. $ git pull origin your_branch_name

====================================

Now your changes are as per previous. So you are done with the undo for “git commit —amend” Now you can do “git push origin <your_branch_name> “, to push to branch