How can I uncommit the last commit in a git bare repository?

From: http://stackoverflow.com/questions/4624881/how-can-i-uncommit-the-last-commit-in-a-git-bare-repository

You can use the git update-ref command. To remove the last commit, you would use:

$ git update-ref HEAD HEAD^
Or if you’re not in the branch from which you cant to remove the last commit:

$ git update-ref refs/heads/branch-name branch-name^
You could also pass a sha1 if you want:

$ git update-ref refs/heads/branch-name a12d48e2
See the documentation of the git-update-ref command.

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

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

Twitter picture

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

Facebook照片

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

Google+ photo

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

連結到 %s