今天发现master的代码写的不对,不想重写,想直接回退到之前一个版本,然后再把这个版本设置为master,弄了好久,终于弄好了。
首选:
</pre><p><pre name="code" class="html">#create a branch
git branch ttt
#step into the branch
git checkout ttt
#back to some commit
git reset --hard HEAD^^
#push new branch into remote reposity
git add .
git commit -m "init new branch"
git push origin ttt
#in the ttt branch
git merge -s ours master
git checkout master
git merge ttt
git add .
git commit -m "init new branch"
git push origin master
#done
本文介绍如何使用Git回退到之前的代码版本,并将该版本设为master分支的最新状态。通过创建新分支、回退到特定提交、推送至远程仓库,最后合并回master分支的方法,实现代码版本的有效管理和更新。
2313

被折叠的 条评论
为什么被折叠?



