Should each commit in a branch implementing a new feature be prefixed by “feat:” using conventional commits?

Consider I’m working on a branch feat-1 implementing a new feature.

I’m confused what to prefix each commit with on that branch. Should they all be prefixed with feat: (after all, they are all part of implementing a new feature), or should it only be the last commit that’s prefixed with feat:?

It’s almost impossible to decide whether a commit is the last commit on a branch, and I often find myself going back fixing bugs, introducing new commits, after I thought I made the last commit.

So, I end up with a commit history, like:

  • infra: adding server
  • format(ci): fix format of files
  • feat: implementing feature
  • ci: adding workflows
  • fix: bugs in feature
  • feat: add more functionality
  • feat: all done

This might be intermixed with chore:s and wip:s.

While, the specification tell us how to “tag” individual commits, I have a hard time translating it to the real world, where multiple commits implement a feature.

https://www.conventionalcommits.org/en/v1.0.0/

4

If you’re working in branches, I’d strongly recommend squashing your commits when you merge into your integration branch. At the very least, I’d use interactive rebasing to clean up the commits on the feature branch prior to merging, leaving only the most relevant commits in the history of the integration branch – commits that fix bugs in the newly developed feature, for example, don’t mean that much once the working feature is in the integration branch.

If you take the approach of interactively rebasing or squashing when merging to the integration branch, you could consider not using the Conventional Commits annotations for work-in-progress commits that you may make since those commit messages would be removed or changed anyway. Only the commits that end up in the integration branch would need to conform to the standard.

Ewan’s answer also brings out a very good point. Not everything needs to be captured in commit messages. Pull requests are a great place to collect a bunch of commits and describe the rational behind changes. In my experience, tools like GitHub and Bitbucket relate the merge commit to the pull request for traceability. Issue trackers also provide a good place for documenting things about a feature over commits. Similarly, both commits and pull requests can be linked to issues. Although Conventional Commits can be helpful, it’s not the whole story.

3

While, the specification tell us how to “tag” individual commits, I
have a hard time translating it to the real world, where multiple
commits implement a feature.

I think you hit the nail on the head here, If you try and put this kind of knowledge in a commit message, rather than say a linked ticket or PR description then you force yourself into making bigger, tested commits. Rather than the old adage of commit fast and often.

If you try and make your commits “neat” then I think you lose some fundamental benefits of source control. Sharing your code, seeing changes that you can undo, seeing the journey you took.

There are plenty of other places you can use to make “neat” messages. merges, pull requests and a ticketing system are better at this than commit messages

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật