0

I am working with a remote repository on BeanstalkApp and am trying to remove the last commit that was pushed to that repo.

I was able to reset my last commit on my local repository by using the following command:

git reset HEAD~1

This command worked fine. Now that I have my local repo back to where it was before this commit, I want to push this master branch to the remote Repo on BeanstalkApp.

I tried using the following command:

git push --force -u origin master

After pushing my repo back onto the Master branch, I did not see the last commit removed from the remote repo.

Is there a step I'm missing in performing this process?

Any help is greatly appreciated!

Jeff P.
  • 2,754
  • 5
  • 19
  • 41
  • You might need to force push, but changing public history should generally be avoided. – crashmstr Sep 28 '17 at 18:42
  • @crashmstr I edited my `git push` command from above and actually tried using the `--force` command but that didn't make any differences. – Jeff P. Sep 28 '17 at 18:45
  • 1
    better to make revert instead reset – Alexan Sep 28 '17 at 18:45
  • @Alexan The weird thing is I reset my local repo and when I run `git log`, I can see on my local machine that the last commit was actually removed successfully. – Jeff P. Sep 28 '17 at 18:59
  • try `git push origin master --force' – Alexan Sep 28 '17 at 19:23
  • https://stackoverflow.com/a/24768381/240564 – Alexan Sep 28 '17 at 19:24
  • @Alexan I did some more research and it appears that I'm working with a detached head such as seen here: https://stackoverflow.com/questions/30471557/git-push-master-fatal-you-are-not-currently-on-a-branch – Jeff P. Sep 28 '17 at 19:31
  • did you get any message during push? – Alexan Sep 28 '17 at 19:33
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/155550/discussion-between-jeff-p-and-alexan). – Jeff P. Sep 28 '17 at 19:33

0 Answers0