💡The Perfect Commit💡 [1/9]
A thread on how to add the right changes and how to compose the perfect commit message 👇
Your colleagues (and your future self) will thank you for that! #gittowertips
💡The Perfect Commit💡 [2/9]
The most important rule is to only combine changes from the SAME TOPIC in a single commit.
Avoid cramming everything in a single commit — address different topics on separate commits. #gittowertips
💡The Perfect Commit💡 [3/9]
In Tower's staging area, you can easily commit specific files (or specific parts of those files, called chunks or hunks) for more granularity. You can even select individual lines of code! #gittowertips
💡The Perfect Commit💡 [4/9]
In the CLI, use the `-p` flag (e.g.: git add -p index.html) to go through each chunk of changes to a file and pick what should be included in the commit. For every chunk you would like to add, type Y for yes. Otherwise, hit N for no. #gittowertips
💡The Perfect Commit💡 [5/9]
Let's reflect on the perfect commit message now 🔥
The SUBJECT LINE should be concise and summarize what happened (ideally, in less than 80 chars). Too hard? You're probably addressing too many different topics in a single commit. #gittowertips
💡The Perfect Commit💡 [6/9]
You can add a more detailed explanation in the BODY of the commit message. Here are some good questions to answer:
- What is now different from before?
- What’s the reason for the change?
- Is there anything to watch out for? #gittowertips
💡The Perfect Commit💡 [7/9]
In Tower, writing the body of the commit message couldn't be easier. You can type "/" to reference other commits or staged files. And you can configure constraints (e.g.: character limit) so that everyone follows your team's conventions. #gittowertips
💡The Perfect Commit💡 [8/9]
Writing the body of the commit message can also be done using a text editor via the CLI. By adding an empty line after the subject, Git will know you are writing the body of the message. #gittowertips
💡The Perfect Commit💡 [9/9]
Writing clear commit messages will help understand what happened in each revision and what to watch out for. We hope you found this thread useful!
Make sure you follow #gittowertips and @gittower for more tips ✌️
• • •
Missing some Tweet in this thread? You can try to
force a refresh