title: How to push "undo pushed commit" using command line?
body: <p>EDIT: Ok so I work it out. The problem is how I stated the branch name. It's supposed to be <code>git push -f origin card-editor</code> instead of <code>git push -f origin/card-editor</code>. Thanks.</p>
  <hr />
  <p>The majority of time I work with git, I use sourcetree. Except when &quot;major disaster&quot; things happened. This is one of the situation (for me). Long story short, I do a commit and push, but now I want to undo it on the local, as well as undo it on the remote.</p>
  <p>I follow tutorial from <a href="https://www.delftstack.com/howto/git/undo-pushed-commits-in-git/" rel="nofollow noreferrer">here</a>. I successfully <code>reset --hard</code> the head to the last good commit. Now it's just the matter of pushing it to the server.</p>
  <p>The way the tutorial does it looks very simple.</p>
  <pre><code>git push -f branchname
  </code></pre>
  <p>My feature branch remote name is &quot;card-editor&quot;. So I did it.</p>
  <pre><code>git push -f card-editor
  </code></pre>
  <p>But I got error that says &quot;card-editor&quot; does not appear to be a git repository.</p>
  <p>I listed my list of branch with <code>git branch -r</code>.</p>
  <pre><code>origin/HEAD -&gt; origin/master
  origin/card-editor
  origin/development
  origin/staging
  origin/production
  </code></pre>
  <p>Alright, so I think the branch name is <code>origin/card-editor</code>. So I retry it.</p>
  <pre><code>git push -f origin/card-editor
  </code></pre>
  <p>But it still showing &quot;origin/card-editor&quot; does not appear to be a git repository.</p>
  <p>What's wrong with my approach? I don't think there's something special that needs to be done here? I'm not particularly versed with Git, especially with console command, as usually I use sourcetree to manage it.</p>