Tower Profile picture
25 Nov, 9 tweets, 5 min read
💡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 Staging a chunk in the CLI
💡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 Configuring commit constraints in Tower
💡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 Writing the body of the commit message with a text editor
💡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
 

Keep Current with Tower

Tower Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Thank you for your support!

Follow Us on Twitter!

:(