Skip to Content
程序员的38堂成长课
book

程序员的38堂成长课

by Pete Goodliffe
January 2022
Beginner to intermediate
314 pages
6h 55m
Chinese
Posts & Telecom Press
Content preview from 程序员的38堂成长课
152
20
20.3.3
 存储软件版本
是否应该对构建的软件版本进行版本控制?有些项目将它们所有的发行版都放到一个仓库
中。这通常是一个单独的发布仓库。二进制文件并不真正属于项目源文件。
考虑将这些文件归档到其他简单的静态目录结构中。当记录较少动态变动的文件结构时,
版本控制不会给你带来太多好处。使用文件服务器进行这种归档可能会更容易。
20.3.4
 代码库的布局
仔细考虑代码库的布局。确保目录结构清晰且与代码的结构一致。在顶层包含一个有用的
read me
”文档。
坚决地避免重复。正如代码中的复制会导致
bug
一样,仓库中的文件复制也会导致
bug
小心管理第三方代码,将其与你自己的源文件分开。将它们放在标记清楚的子目录下。这
可以帮助你跟踪来自第三方的更改,而不会和自己的文件弄混。
确保仓库被正确配置,可以忽略不需要的文件。可以根据模式匹配规则指示大多数系统忽
略某些文件。这有助于防止你意外地签入个人设置文件、自动生成的文件等。
20.4
 用好版本控制系统
改变和改善是两回事。
——谚语
如果“使用版本控制系统”是黄金法则,那么“
用好
版本控制系统”
就是白银法则。真正
理解版本控制系统的工作方式以及使用它的最佳实践是很重要的。
下面是一些普遍的做法。
20.4.1
 原子提交
提交到仓库的每个更改都说明了你对代码所做的工作。考虑一下该如何讲述这个故事,才
能使记录下来的历史清清楚楚。
进行小的原子提交。这样的修改更容易理解,也更容易检查是否正确。这是一个
小而频繁
的提交策略。
要诀
提交要
小而频繁
高效版本控制 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

管理Kubernetes

管理Kubernetes

Brendan Burns, Craig Tracey
Python应用开发指南

Python应用开发指南

Posts & Telecom Press, Ninad Sathaye
解密金融数据

解密金融数据

Justin Pauley

Publisher Resources

ISBN: 9787115577948