何时开始在 VCS 中跟踪项目?

发布于 2024-09-15 20:42:32 字数 396 浏览 2 评论 0原文

我最近发现,我经常想要去尝试一些我有的新想法(作为一个新项目),如果一个小时左右它看起来很有希望,我会保留它。如果没有的话,我会把它扔掉。

那么我的问题是,我什么时候应该开始跟踪这些小实验?从一开始,就像使用 hg initrevolutionary_idea 一样,还是在我决定应该保留它之后?

现在,我正在等待,直到我充实了脑海中出现的任何想法,然后初始化并提交,因为我不想思考“我现在应该提交吗?”每隔一个保存。

但另一方面,如果我从一开始就定期做出承诺,那么我就会有一个非常详细的时间表,记录我所做的一切以及原因。

第三,如果我从头开始跟踪,直到我知道我想保留它才提交,那么这与稍后进行初始化没有什么不同,对吧?

你们觉得怎么样?在这种情况下,“最佳实践”是什么?

I've been finding lately that often I will want to go off and hack at some new idea I have (as a new project), and if in an hour or so it looks promising, I will keep it. If not, I will trash it.

My question, then, is when should I start tracking these little experiments? From the very beginning, like with hg init revolutionary_idea, or after I decide I should keep it?

Right now, I am waiting until after I flesh out whatever idea has popped into my head, then initializing and committing, because I don't want to be thinking "should I commit now?" every other save.

On the other hand, though, if I commit regularly from the beginning, then I will have a very detailed timeline of everything I've done and why.

On the third hand, if I track from the beginning, and don't commit until I know I want to keep it, then it would be no different from just doing an initialization later on, right?

What do you guys think? What is the "best practice" in this case?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

千と千尋 2024-09-22 20:42:32

我在生成新项目后立即 git init 。 Git 是如此轻松,没有理由不这样做。我不断地分支、提交、合并等。这只是做某事的一种简单方法,你不必担心失败的实验或任何事情,因为它们可以很容易地被撤销。

所以在我看来,如果你没有一直使用版本控制,那么你就做错了。除了单文件脚本和非常快速的小演示程序。我不费心使用 git 来跟踪这些。

I git init right after generating a new project. Git is so effortless, there's no reason not to do it. I'm continually branching, committing, merging, etc. It's just an easy way to do something and you don't have to worry about failed experiments or anything, because they can easily be undone.

So in my opinion, if you aren't using version control all the time, you're doing it wrong. Except for single-file scripts and really quick little demonstration programs. I don't bother using git to track those.

失与倦" 2024-09-22 20:42:32

DVCS - 提交更改的频率和时间中所述,您可以在私有分支(即您不会在其他地方发布/推送的分支)中根据需要多次提交。

当您知道要保留特定的开发路线时,您可以 将您的提交重新组织为逻辑提交(每个提交代表稳定状态,例如通过单元测试)或简单的合并--squash所有的事情。

但不要走极端:它 每次使用 DVCS 保存后进行提交是没有意义的

As explained in DVCS - How often and when to commit changes, you can commit as many times as necessary in a private branch (i.e. a branch you will not publish/push elsewhere).

When you know you want to keep a particular line of development, then you can reorganize your commits into logical commits (each ones representing a stable state, passing unit testing for instance) or simple merge --squash the all thing.

Don't go to extreme though: it doesn't make sense to commit after every save with a DVCS.

谁的新欢旧爱 2024-09-22 20:42:32

通常,如果我要开始某件事,我要做的第一件事就是创建存储库。使用 git 和 hg 创建存储库是如此轻量级,这样做不会造成任何损失,而且可以获得很多东西。

如果发现新项目没有任何进展,您可以删除它、存储库和所有内容。

Usually, if I'm starting something, the first thing I do is create the repository. Creating the repository is so light weight with git and hg that there's nothing lost by doing it, and so much to be gained.

If it turns out the new project isn't going anywhere, you can just delete it, repository and all.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文