Repository navigation
Rules for making commits
Commit is a bundle of changes united by a single semantic load and idea. A good commit is a good and formulated suggestion in the repository's history. It should briefly but informatively reflect the essence of the changes made to the repository. To create a commit, you need:
- Start tracking files in which changes have been made using the
git add <file-name>command (or usegit add .for add all changed files); - Сreate a commit message using the command
git commit -m "<your-message>";
In case you forgot to add minor changes to an already made commit, you can use the command git commit --amend. This will allow you not to create a new commit, but to add the changes you made to the previous one.
In order to create a full-fledged commit, it is recommended to use the command git commit -m without "<your-message>". After this command, the commit text editor opens. Press I key for start edit. In this window, the first line is a brief description of the commit. The second line is omitted for separation. On the third line, a detailed description of the commit begins (if necessary).
1. [commit-tag] short description
2. # Empty string
3. Full description of commit
After the description of the commit is finished, press Esc to exit editing mode, press Shift + :, enter wq and press Enter. The commit was successfully created.
An example of a good commit was described above (a code snippet containing three lines). Below is a list of commit tags that are highly recommended to use when working with the repository:
-
feat- new feature; -
upgrade- upgrade of current working code; -
fix- error correction; -
docs- changes in documentation; -
ui- changes that do not affect functionality (formatting, styles); -
refactoring- changing the code without adding functionality; -
test- adding tests; -
chore- other changes (dependency updates, etc.).
Example of good commit:
1. [feat] add leaderboard
2.
3. Leaderboard allows you to track player ratings in real time.
The project tree should be clean and understandable. Before creating a commit, re-analyze all your changes. Think about whether you have included everything you wanted and only then create a commit.