git版本回滚

最近总发生代码错误删除,需要回滚到某个状态,记录一下步骤:
回滚到某个版本并提交:
git reset –hard cdd281618eee2890edb8a8e7aa254aa7d2a9baef
git push -f origin master

强制刷到最新版本:
git fetch –all
git reset –hard origin/master
git fetch 只是下载远程的库的内容,不做任何的合并 git reset 把HEAD指向刚刚下载的最新的版本

 

如果当前在某个游离的分支上,需要切换到主分支

git branch temp ef59d39  将本地分支取个临时名称

git checkout master  本地分支切换到主分支(master)

git merge 本地分支名  本地分支合并到主分支

git push 提交合并

 

克隆某个分支到本地

git clone -b  branch_name  git@v.src.corp.qihoo.net:whitelist_scancenter/mobile_spider.git   local_folder_name

You May Also Like

About the Author: daidai5771

发表评论

电子邮件地址不会被公开。 必填项已用*标注