Table of Contents....2
Title Page....17
Introduction....18
Part I: Getting Started with GitHub Copilot....19
CHAPTER 1: Get Started with GitHub Copilot....20
Learn Why GitHub Copilot Matters....20
Create a GitHub Account....21
Acquire a GitHub Copilot License....21
Install an IDE Extension....22
First Run: Test Copilot....28
Conclusion....34
Reference....35
CHAPTER 2: Decoding GitHub Copilot....36
Uncover the AI Behind GitHub Copilot....36
Understand Security, Privacy, and Data Handling....37
Understand Copyright Protections....39
Explore the GitHub Copilot Trust Center....40
Conclusion....41
References....41
Part II: GitHub Copilot Features in Action....42
CHAPTER 3: Exploring Code Completions....43
Introducing Code Completions....43
Working with Copilot Code Completions....43
Discovering the Toolbar and Panel....52
Updating Copilot Settings....55
Leveraging Keyboard Shortcuts....57
Conclusion....60
CHAPTER 4: Chatting with GitHub Copilot....61
Discovering Copilot Chat....61
Defining Prompt Engineering with Copilot Chat....70
Commanding Your Conversation with Precision....75
Conclusion....91
Part III: Practical Applications of GitHub Copilot....93
CHAPTER 5: Learning a New Programming Language....94
Introducing Language Education with Copilot....94
Setting Up Your Development Environment....95
Learning the Basics....97
Creating a Console Application....99
Explaining Code with Copilot....103
Adding New Code....104
Learning to Test....105
Conclusion....113
Reference....114
CHAPTER 6: Writing Tests with Copilot....115
Establishing the Example Project....115
Adding Unit Tests to Existing Code....117
Exploring Behavior-Driven Development with Copilot....123
Conclusion....129
CHAPTER 7: Diagnosing and Resolving Bugs....130
Establishing the Example Project....130
Fixing Syntax Errors....132
Resolving Runtime Exceptions....134
Resolving Terminal Errors....139
Conclusion....141
CHAPTER 8: Code Refactoring with Copilot....142
Introducing Code Refactoring with Copilot....142
Establishing the Example Project....143
Refactoring Duplicate Code....144
Refactoring Validators....153
Refactoring Bad Variable Names....161
Documenting and Commenting Code....163
Conclusion....167
CHAPTER 9: Enhancing Code Security....169
Detailing Code Security....169
Establishing the Example Project....170
Exploring Code Security....171
Finding and Fixing Security Issues....175
Conclusion....180
CHAPTER 10: Accelerating DevSecOps Practices....181
Detailing DevSecOps....181
Simplifying Containers....183
Automating Infrastructure as Code....187
Streamlining CI/CD Pipelines....192
Conclusion....199
CHAPTER 11: Enhancing Development Environments with Copilot....200
Amplifying Visual Studio with Copilot....200
Elevating Azure Data Studio with Copilot....208
Boosting JetBrains IntelliJ IDEA with Copilot....215
Enhancing Neovim with Copilot....222
Consulting Copilot in the GitHub CLI....228
References....235
Conclusion....235
CHAPTER 12: Universal Conversion with GitHub Copilot....236
Translating Natural Language to Programming Languages....236
Converting JavaScript Components....239
Simplifying CSS Styles....241
Enhancing Nontyped Languages with Types....247
Transitioning Between Frameworks and Libraries....250
Converting Object-Oriented Languages....255
Migrating Databases....257
Transitioning CI/CD Platforms....259
Modernizing Legacy Systems....262
Conclusion....267
Reference....268
Part IV: Key Insights and Advanced Use Cases for GitHub Copilot....269
CHAPTER 13: Considering Responsible AI with GitHub Copilot....270
Introducing Responsible AI....270
Examining How Copilot Implements Responsible AI....271
Programming with AI Responsibly....280
Conclusion....281
References....281
CHAPTER 14: Augmenting the Software Development Life Cycle with GitHub Copilot....283
Introducing the SDLC....283
Assessing the Adoption of AI in the SDLC....286
Detailing Levels of AI Integration in the SDLC....287
Showcasing GitHub Copilot in the SDLC....294
Addressing Concerns: AI Adoption and the Future of Work....309
Conclusion....310
References....311
CHAPTER 15: Exploring Copilot Business and Enterprise....312
Introducing Copilot Business and Enterprise....312
Chatting with Copilot in GitHub.com....317
Indexing Code Repositories to Improve Copilot's Understanding....323
Getting Better Answers with the Knowledge Base....329
Leveraging Copilot Chat in Code Repository Files....337
Enhancing Pull Requests with Copilot....345
Managing GitHub Copilot....356
Looking Ahead....360
Conclusion....362
References....362
Conclusion....364
APPENDIX A: Resources for Further Learning....365
GitHub Copilot Overview and Subscription Plans....365
Community Engagement and Support....366
Legal and Ethical Considerations....367
Research and Insights....368
Glossary....370
Index....380
Copyright....408
Acknowledgments....409
About the Author....410
About the Technical Editor....410
End User License Agreement....411
In Programming with GitHub Copilot: Write Better Code — Faster, veteran software developer and GitHub community hero Kurt Dowswell delivers an insightful and hands-on exploration of GitHub's powerful, new AI coding assistant, Copilot. In the book, you'll discover how to use the tool's capabilities to push the boundaries of what you thought was possible in programming.
Even if you've used autocomplete tools—like VS Code's TabNine extension—before, you'll be floored by GitHub Copilot's potential to transform the way you code. You'll learn how to install, configure, and use the software, from employing it's most common and widely used features to deploying business and enterprise functionality. You'll even discover how to fix runtime and compilation bugs and write unit, integration, and end-to-end tests.
Perfect for practicing programmers, developers, and software engineers, Programming with GitHub Copilot is also an essential resource for coders and other IT practitioners-in-training who want to expand their knowledge and improve the scope and depth of their programming skillsets.