git 回滚版本

Posted by wxianfeng Sun, 21 Aug 2011 04:28:00 GMT

git 版本出错了,如何回滚到之前某一个版本,思路是本地回滚到之前某个版本,然后把远程分支删除,然后以本地的回滚版本重新建立分支

# 新建old_master分支做备份   
>git branch old_master   

# push到远程   
>git push origin old_master:old_master   

# 本地仓库回退到某个版本   
>git reset --hard baeertasdasdvf

# 删除远程的master分支   
>git push origin :master   

# 重新创建master分支   
>git push origin master  

# 重新clone代码
>git clone git@192.168.10.201:xxx.git

This entry was posted on Sun, 21 Aug 2011 04:28:00 GMT and Posted in . You can follow any any response to this entry through the Atom feed. You can leave a comment or a trackback from your own site.

Tags ,


Trackbacks

Use the following link to trackback from your own site:
http://wxianfeng.com/trackbacks?article_id=213

Comments

  1. Avatar
    passenger Ships bari Patras over {{count}} years ago:

    Thanks for the gopod writeup. It in reality was a amusement account it.
    Look complicated to far added agreeable from you!
    By the way, how could we keep up a correspondence?

  2. Avatar
    greece ferry over {{count}} years ago:

    Hello, i read your blog occasionally and i owwn a similar onee and
    i was just curious if you get a lot of spam feedback? If so
    how do you preven it, any plugin or anything you can advise?
    I get so much lately it’s driiving me crazy so any assistance is
    very much appreciated.

  3. Avatar
    miniurl.x10.mx over {{count}} years ago:

    Admiring the hard wok you put into your site and detailed information you
    present. It’s awesome to come across a blog every once in a
    while that isn’t the same outdated rehashed material.
    Fantastic read! I’ve bookmarked your site and I’m adding
    your RSS feeds to my Google account.

  4. Avatar
    miniurl.x10.mx over {{count}} years ago:

    Admiring the hard work you put into your site and detailed
    information you present. It’s awesome to
    come across a blog every once in a while that isn’t the
    same outdated rehashed material. Fantastic read! I’ve bookmarked your sikte and I’m adding your
    RSS feeds to my Google account.

Leave a comment