DEV Community

Git Cheatsheet

Sarath P M on September 03, 2022

Hey there, fabulous folks! Behold, a swift and snappy cheat sheet for your Git command adventures: git config Setup author name and ma...
Collapse
 
thonio profile image
Thonio • Edited

Very nice to see it! But, from experience, I noticed git add -A is not the same has git commit -a or git add .. In the case who you add "new" file on project. New file need to add with git add -A otherwise it will be ignored.

Collapse
 
vinceamstoutz profile image
Vincent Amstoutz

Very good explantions and work. Just a suggestion to complete your cheatsheet : it's recommend to use git push --force-with-lease instead of only git push -f or git push --force in most cases. A full example of this topic here.

Collapse
 
tiag00liveira profile image
Tiago Oliveira de São José

Very good, thanks for sharing.
You can use git switch to create, change, etc. branchs
I like this command, because for me it's more semantic than checkout in these cases.

See more in git doc: git-scm.com/docs/git-switch

Collapse
 
kasukur profile image
Sri • Edited

very nice list of commands, you might want to add Rewriting the most recent commit message - git commit --amend. This is useful when we have rules for the hook when we push the commits.

Collapse
 
sarath-pm profile image
Sarath P M

Thanks for the feedback, Sri. I will add it. 😊

Collapse
 
anderspersson profile image
Anders Persson

Great this will be in my "save" list. thanks.

Collapse
 
lakuapik profile image
David Adi Nugroho

$ man giteveryday

Collapse
 
raddevus profile image
raddevus

Very nice & helpful summary of numerous git features. Thanks for sharing. I bookmarked this for later use. really great

Collapse
 
sarath-pm profile image
Sarath P M

I'm really glad to hear that 😊

Collapse
 
imranshaik012 profile image
Imran Shaik

Very helpful, thanks for sharing

Collapse
 
xilam675 profile image
xilam675

Good job

Collapse
 
romankurnovskii profile image
Roman

helpful, thank you
what about "revert" usage for some commits ?

Collapse
 
krighaar profile image
Peter Krighaar

Nice walkthrough, what about git prune in order to clean up for repos in origin, not existing any more

Collapse
 
hassan_dev91 profile image
Hassan

Thanks, that's so sweet ❤️

Collapse
 
kevincp17 profile image
kevincp17

This is pretty neat, thanks

Collapse
 
macantovitz profile image
Matheus Cantovitz

Very good, thanks for sharing