## Working with commits When working with commits, utilize git commit -m to record changes, git amend to modify the most recent commit, and try your best to adhere to commit message conventions. ``` # Make sure to add a message to each commit git commit -m "meaningful message" ``` If you have changes to your last commit, you don’t have to create another commit altogether, you can use the - — amend flag to amend the most recent commit with your staged changes ``` # make your changes git add . git commit --amend # This will open your default text editor to modify the commit message if needed. git push origin your_branch --force ``` > Exercise caution when utilizing --force, as it has the potential to overwrite the history of the target branch. Its application on the main/master branch should be generally avoided. As a rule of thumb it’s better to commit more often than not, to avoid losing progress or accidentally resetting the unstaged changes. One can rewrite the history afterwards by squashing multiple commits or doing an interactive rebase. Use git log to show a chronological list of commits, starting from the most recent commit and working backward in time ### Sync Commits