2

First of all, I am a noob at using git.

  1. I was working on a project and did a commit and pushed to remote github repository.
  2. But, then later I realized that I did some mistake, so I did $git --amend -am "My message"
  3. Now, I was not able to push again to the remote server as I was getting error. So, I thought of deleting the remote github repo & recreated the same with the same name.
  4. Now, when I try to push, it says "Everything up-to-date".

Please guide as to how do I solve this?

shadyabhi
  • 16,675
  • 26
  • 80
  • 131

1 Answers1

2

Sounds like two things have gone wrong, here.

First up, you amended a commit that had become part of the remote repository's history, which is a bit of a no-no. Rather than re-answer this gripe, I'll direct you to the answer: How do I push amended commit to the remote Git repository?

Next, chances are that even though you re-created the remote repository, your local repository still has the local history from the old one. what you'll want to do is run git remote rm origin, then git gc, then git remote add origin <path_to_repo>, then finally git fetch origin. This should pick up the new remote repository, and allow you to push your changes to it.

Community
  • 1
  • 1
Chris
  • 9,994
  • 3
  • 29
  • 31