# Commit best practice

**URL:** <https://forum.codewithmosh.com/t/commit-best-practice/27941>\
**Category:** Git\
**Created:** [July 29, 2024, 1:29pm UTC](https://forum.codewithmosh.com/t/commit-best-practice/27941 "2024-07-29T13:29:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sivakumar](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@sivakumar](https://forum.codewithmosh.com/u/sivakumar)\
**Post date:** [July 29, 2024, 1:29pm UTC](https://forum.codewithmosh.com/t/commit-best-practice/27941/1 "2024-07-29T13:29:08Z")

</div>

Can you please explain git commit best practices

---

<div class="post-metadata">

**Author:** ![theorion](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/theorion/32/7783_2.png) [@theorion](https://forum.codewithmosh.com/u/theorion)\
**Post date:** [July 29, 2024, 6:55pm UTC](https://forum.codewithmosh.com/t/commit-best-practice/27941/2 "2024-07-29T18:55:09Z")

</div>

Make sure branch is on main, the name master is still okay but people use main more often. Make sure your commit message has meaning. Make sure to ignore files before doing your first commit as they will persist. Try to only commit after a module or component is completed. Push to github often so you don’t lose data in case of crash/ error. Those are the simple ones

---

<div class="post-metadata">

**Author:** ![lucidlear](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/lucidlear/32/5477_2.png) [@lucidlear](https://forum.codewithmosh.com/u/lucidlear)\
**Post date:** [July 29, 2024, 8:12pm UTC](https://forum.codewithmosh.com/t/commit-best-practice/27941/3 "2024-07-29T20:12:25Z")

</div>

dont rewrite history on shared with others repository and each commit should comprise of a single unit of work
