- Mastering React Test:Driven Development
- Daniel Irvine
- 235字
- 2021-06-24 14:45:02
Commit early and often
The second sentence of that command output (You should commit this file) is a good cue for us to commit for the first time.
TDD provides natural breakpoints for you to commit code. If you’re starting out with TDD, I’d recommend committing to source control after every single test. That might seem like overkill for your projects at work, but as you're learning, it can be a very effective tool.
If you've ever watched The Weakest Link, you'll know that contestants can choose to bank their winnings at any time, which decreases their risk of losing money but reduces their earning potential. With git, you can use git add to effectively bank your code. This saves a snapshot of your code but does not commit it. If you make a mess in the next test, you can revert to the last banked state. I tend to do this after every test. And, unlike in The Weakest Link, there's no downside to banking!
Committing early and often simplifies commit messages. If you have just one test in a commit, then you can use the test description as your commit message. No thinking is required.
If you're using git, use the following commands to commit what you’ve done so far:
git init
echo "node_modules" > .gitignore
git add .
git commit -m "Blank project with Jest dependency"
- Flask Web全棧開發實戰
- Spring 5.0 By Example
- Monkey Game Development:Beginner's Guide
- Photoshop智能手機APP UI設計之道
- Access 數據庫應用教程
- Flink SQL與DataStream入門、進階與實戰
- Learning ASP.NET Core 2.0
- Elastic Stack應用寶典
- 響應式架構:消息模式Actor實現與Scala、Akka應用集成
- 現代C++編程實戰:132個核心技巧示例(原書第2版)
- Microsoft 365 Certified Fundamentals MS-900 Exam Guide
- 網絡數據采集技術:Java網絡爬蟲實戰
- Java Web應用開發給力起飛
- 跟戴銘學iOS編程:理順核心知識點
- 物聯網系統架構設計與邊緣計算(原書第2版)