HOWTO undo a git push

Normally, undoing git remote commands is close to a nightmare, but a quick search returned the following for undoing git push command:

$ git hist
* abc123 <date> | Latest push
* abc100 <date> | 2nd last push

Option 1:
$ git reset --hard abc100
$ git push <origin> <branch>

Option 2:
$ git push -f <origin> abc100:<branch>
$ git reset --hard abc100

Filing this away as one more lifesaving tip!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s