markdown 将我的项目的早期版本还原到一个闪亮的新Git分支

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 将我的项目的早期版本还原到一个闪亮的新Git分支相关的知识,希望对你有一定的参考价值。

## Restoring a Revision in a New Local Branch 
As I said, using the reset command on your HEAD branch is a quite drastic action: it will remove any commits (on this branch) that came after the specified revision. If you're sure that this is what you want, everything is fine.

However, there is also a "safer" way in case you'd prefer leaving your current HEAD branch untouched. Since "branches" are so cheap and easy in Git, we can easily create a new branch which starts at that old revision:

```
$ git checkout -b old-project-state 0ad5a7a6
```
Normally, the checkout command is used to just switch branches. However, providing the -b parameter, you can also let it create a new branch (named "old-project-state" in this example). If you don't want it to start at the current HEAD revision, you also need to provide a commit hash - the old project revision we want to restore.

Voilà: you now have a new branch named "old-project-state" reflecting the old version of your project - without touching or even removing any other commits or branches.

[How can I restore a previous version of my project?](https://www.git-tower.com/learn/git/faq/restore-repo-to-previous-revision)

以上是关于markdown 将我的项目的早期版本还原到一个闪亮的新Git分支的主要内容,如果未能解决你的问题,请参考以下文章

iOS 如何使用早期版本的 iOS 中不存在的情节提要元素?

idea 代码提示 点出第一个字母闪一下提示就消失

如何将我的本地数据库还原到 Windows Azure 数据库?

为啥我在将我的 Electron 项目更新到最新版本后会看到“电子安全警告”?

难以安装和运行rails(/ usr / local / bin / rails:没有这样的文件或目录),曾经恢复到早期的rails版本

如何将我的布局路径正确定位到使用 HTML、EJS 和 Markdown 构建的 11ty (Eleventy) 博客目录?