简体   繁体   English

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

[英]Using Git to organize a folder with different versions of the same project

I have a folder similar to this:我有一个类似这样的文件夹:

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

Where "Changelog.txt" is something like:其中“Changelog.txt”类似于:

2.0: Added a pause at the end.

2.1: Changed pause to os.system("pause").

Obviously this is not the best solution for version control.显然,这不是版本控制的最佳解决方案。 How can I use Git to organize my project?如何使用 Git 来组织我的项目? Ideally, I'd want a folder somewhat like this:理想情况下,我想要一个有点像这样的文件夹:

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

But I don't want to lose the version numbers and changelog comments.但我不想丢失版本号和更改日志注释。


More information:更多信息:

I'm completely new to Git.我对 Git 完全陌生。 I've looked at similar questions like:我看过类似的问题,例如:

What is git tag, How to create tags & How to checkout git remote tag(s) 什么是 git 标签,如何创建标签以及如何检出 git 远程标签

What is the Git equivalent for revision number? 修订号的 Git 等价物是什么?

How to manage the version number in Git? Git如何管理版本号?

But they seem too technical for me right now and it doesn't look like they address my specific problem.但它们现在对我来说似乎太技术性了,而且看起来它们并没有解决我的具体问题。

What you need is an introductory course on git.你需要的是一门关于 git 的入门课程。 You can find tons of free ones online.您可以在网上找到大量免费的。 Very basic use of git is all you need.对 git 的非常基本的使用就是你所需要的。

Your "changelog comments" will turn into git commit messages.您的“更改日志评论”将变成 git commit 消息。 You can include a "revision number" as part of your commit message if you like.如果您愿意,您可以将“修订号”作为提交消息的一部分。

The git log will be your new changelog. git log 将是您的新更改日志。

At this stage the only git commands you need are init (one time only), add , commit , status and log .在此阶段,您需要的唯一 git 命令是init (仅一次)、 addcommitstatuslog

EDIT:编辑:

eg例如

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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Git,让人们看到同一项目的不同版本的最佳方法是什么? - Using Git, what is the best way to allow people to see different versions of the same project? git维护同一个项目的2个版本,每个版本都有不同的用户 - git maintaining 2 versions of the same project, with different users on each 如何在git repo中组织项目的不同部分? - How to organize different parts of project in git repo? 如何将具有项目名称和版本的不同 Jupiter notebook 的文件夹转移到 Git 项目中? - How to transfer a folder with different Jupiter notebooks with project names and versions into a Git project? 同一项目文件夹中不同 git 存储库的全局多个用户名 - Multiple usernames globally for different git repositories in the same project folder Git替换2个相同的应用版本(文件夹到仓库) - Git replace 2 versions same aplication (folder to repo) 在git中处理相同的代码库,不同的应用程序版本 - Handle a same codebase, different app versions in git 使用 git With 部署项目(与本地文件夹结构不同的存储库) - Deploy project using git With (Respository with different folder estructure than local) git:将文件夹替换为不同分支上的同一文件夹 - git: replace folder with the same folder on a different branch 使用项目的不同版本的Git工作流程 - Git workflow using disparate versions of a project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM