Pages

Friday, January 31, 2014

Deleting the last commit pushed to remote repo

Let's say that you have a repo called "origin" with a branch named "UK-December". In order to remove the last commit, follow these steps:

1. Get the commit history.

$git hist
* ef92aa4 2014-01-31 | pretty sure?
* e5d2440 2014-01-30 | Bitmap loading
* 954b23a 2014-01-30 | PRIO-40: fixed?
...

The commit we want to delete is ef92aa4

2. Use the following command to force git to rebase the UK-December repo to the parent of ef92aa4.

$git push origin +ef92aa4^:O2UK-December

Thats it. Your remote commit is gone!

No comments:

Post a Comment