使用 Git 组织包含同一项目不同版本的文件夹



我有一个类似于这样的文件夹:

Hello World
├── Hello World 1.0.py
├── Hello World 2.0.py
├── Hello World 2.1.py
└── Changelog.txt

其中"Changelog.txt"是这样的:

2.0: Added a pause at the end.
2.1: Changed pause to os.system("pause").

显然,这不是版本控制的最佳解决方案。如何使用 Git 来组织我的项目?理想情况下,我想要一个有点像这样的文件夹:

Hello World
├── Hello World.py
└── .git
└── (...)

但我不想丢失版本号和更改日志注释。


更多信息:

我对 Git 完全陌生。我看过类似的问题,例如:

什么是git标签,如何创建标签和如何签出git远程标签

修订号的 Git 等效项是什么?

如何在 Git 中管理版本号?

但是它们现在对我来说似乎太技术性了,看起来它们并没有解决我的具体问题。

你需要的是一门关于 git 的入门课程。 您可以在网上找到大量免费内容。 您只需要非常基本的 git 使用。

您的"更新日志评论"将变成 git 提交消息。如果您愿意,可以在提交消息中包含"修订号"。

git 日志将是您的新更新日志。

在这个阶段,你只需要 git 命令是init(仅一次(、addcommitstatuslog

编辑:

例如

git init
git add .
git commit -m '1.0: first version'
(make changes)
git add .
git commit -m '2.0: Added a pause at the end.'
(make changes)
git add .
git commit -m '2.1: Changed pause to os.system("pause").'
git log
(you will see both a list of all 3 commits along with your messages)

最新更新