- Mastering React Test:Driven Development
- Daniel Irvine
- 532字
- 2021-06-24 14:44:58
Working with section tags
There are two separate code bases in this book, and they have their own branches: appointments and spec-logo. Chapter 1 to Chapter 9 cover appointments; Chapter 10 to Chapter 14 cover spec-logo. (Chapter 15 doesn't have any code.)
If you were to check out these branches, you'd get the final, completed versions of the code. This is an interesting sneak peak but it's not how you'll get started.
Instead, many sections have a designated tag, so you can skip to the tag and examine the code at that point. If you see a callout like this:
...then you can skip to this tag by issuing the following command:
git checkout tags/animation
Once you've output that command, you will be in the detached head state. If you want to begin making changes at that point, you should create a new branch from the tag and work on that. I'd suggest suffixing the name with -mine so that your branches are clearly distinguishable from tags:
git checkout -b animation-mine
You can then commit to this branch. If you have been following along judiciously within your own branch, then you do not need to check out each tag, since you'll already have all of the same code.
However, sometimes you will see a callout like the one that follows, and that means you will need to check out the new tag:
For more detailed instructions, see the To get the most out of this book section in the Preface.
This type of callout means that the code base now contains additional changes since the last edits covered in the book. It often happens at the start of each chapter when the preceding chapter had exercises, but it also happens when the code base skips ahead with changes that are uninteresting or not related to the content of the book.
When you see this callout, you have two options:
- You can choose to check out the new tag and start a new branch, starting afresh. In this case, the instructions are the same as before, except now you'd need a different branch name from your existing branch:
git checkout tags/load-available-time-slots
git checkout -b load-available-time-slots-mine
- You can choose to continue working on the branch you have. This could be because you've been creative and made changes that aren't covered in the book (which I fully support). In this case, git diff and git merge are your friends. You will want to review the changes in the latest tag, and then git merge them in. You may need to handle conflicts:
# to view the differences in the new tag
git diff tags/load-available-time-slots
# to auto-merge those differences into your branch
git merge tags/load-available-time-slots
The second option is not entirely risk free, mainly due to the Exercises section at the end of each chapter.
- OpenStack Cloud Computing Cookbook(Third Edition)
- Moodle Administration Essentials
- PostgreSQL for Data Architects
- Python深度學習:模型、方法與實現
- LabVIEW虛擬儀器入門與測控應用100例
- C/C++數據結構與算法速學速用大辭典
- 匯編語言編程基礎:基于LoongArch
- Android群英傳
- Emgu CV Essentials
- CRYENGINE Game Development Blueprints
- JavaScript從入門到精通(視頻實戰版)
- HTML并不簡單:Web前端開發精進秘籍
- Puppet Cookbook(Third Edition)
- 計算機視覺實戰:基于TensorFlow 2
- 數據庫基礎與應用實驗教程:Visual FoxPro 6.0