DEV Community

loading...

Discussion on: Git cheatsheet

Collapse
darkwiiplayer profile image
DarkWiiPlayer • Edited

git commit -am "message"

There's nothing wrong with doing this every now and then, but I've seen repeatedly that people tend to use -am as their only way to make commits, which leads to poorly written/formatted commit messages and committing too many files. Don't overuse!

git commit --amend --no-edit

This combination is very useful, but it can be even better: git config --global alias.fixup commit --amend --no-edit --patch ;)

One personal addition:

git log --decorate --oneline --graph --date-order master@{"4 days ago"}..master

To see the commits of the last 4 days in a compact graph :D

Collapse
giulia_chiola profile image
Giulia Chiola Author

Thanks @darkwiiplayer , I really appreciated your feedback! 🙃

About the dangerous --all flag you are absolutely right. We should not overuse it! We should all strive towards making smaller commits involving a single functionality, and only then we could use the -a flag safely.

For the other tips you suggested, I edited the original post and added them. 😎 Thank you!

Forem Open with the Forem app