2

I used the following command to send my local git commit to the server:

git push -u origin my_bransh

How to undo this push?

Mark Stosberg
  • 12,961
  • 6
  • 44
  • 49
MOHAMED
  • 41,599
  • 58
  • 163
  • 268

1 Answers1

2

You just delete the remote reference

git push origin :my_branch

or with the current syntax

git push --delete origin mybranch

You'll also have to prune the local tracking branch from the local repo with

git remote prune origin

or as suggested by cupcake in the comments below,

git fetch -p
Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141
  • It's more typical nowadays to prune remote-tracking branches with `git fetch -p`, but this answer is correct nonetheless. –  Aug 20 '13 at 17:41