0

I created a remote branch for me to do work on. No one else checks into my branch. I just pushed all my file changes to the remote branch and can see it in the remote. I forgot to add something else to my commit message so I ran

git commit --amend

I can see my local branch has my commit additions.

However, when I ran:

git push

my additional commit message aren't pushed to the remote repo. What command do I run such that the remote pushes the additional commit message to go with the files I had edited?

Classified
  • 5,759
  • 18
  • 68
  • 99

1 Answers1

2

Appreciate that when you ran git commit --amend you actually made a new commit on top of your branch, which completely replaced the previous commit with the former message. In order to push the branch, you will need to do a force push:

git push --force origin feature

Keep in mind that amending the commit amounts to rewriting the history of the branch. Doing this can cause problems for others who might be working with that branch, so you should minimize this.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360