Chapter 7 Writing and Committing Code

Chapter 7

Writing and Committing Code

IN THIS CHAPTER

Bullet Committing code in a terminal

Bullet Creating a good commit

Bullet Writing a commit message

Bullet Committing other tools

In this chapter, you write and commit code. The first part, writing code, is a very broad topic — too broad to be covered in this (or any single) book. The code we write in this chapter sets the stage for covering how to create good commits. Most of this chapter focuses on committing code. No matter what kind of code you write, the act of committing that code remains the same.

The code example we use throughout this chapter may seem contrived and overly simplistic. That’s because it is contrived and simple. Don’t let the simplicity, though, distract you because the information in this chapter also applies to large code bases.

Creating a Repository

A commit is the smallest unit of work with Git. It represents a small logical group of related changes to the repository. A commit additionally represents a snapshot in time — the state of the entire repository can be represented by referencing ...

Get GitHub For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.