DEV Community

Panda Quests
Panda Quests

Posted on

What are the most useful git commands you know, that must people don't know?

Top comments (12)

Collapse
 
thomaslombart profile image
Thomas Lombart

I like to use git status -sb. Basically, it gives you the clean version of git status.

Collapse
 
pandaquests profile image
Panda Quests

Super. Thanks for sharing

Collapse
 
irregula_exprsn profile image
Muhammad Iliyas

git log --oneline --graph

Collapse
 
pandaquests profile image
Panda Quests

Thanks for sharing

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

I don't know, but I think it depends on whether you are a git master (if you are so good).

TIL git rebase -i HEAD~10, and edit it to either split or squash commits. Then git push -f.

git config --global core.editor 'nano' is required, if you are bad with vim. If you want to use VSCode, probably 'code -w', I think, I forgot.

Collapse
 
pandaquests profile image
Panda Quests

Love it. Although I know this one already

 
irregula_exprsn profile image
Muhammad Iliyas

Understood, tested it. ☑️

Thanks, Daniel.

Thread Thread
 
irregula_exprsn profile image
Muhammad Iliyas
  • Daniel - You can update the commit message even after it's pushed.

    • You've to push changed commit forcefully.
    • git push origin <branch_name> -f
Collapse
 
pandaquests profile image
Panda Quests • Edited

Ah classic. I know that one, too. Don't forget to force push. Thanks for sharing

Collapse
 
irregula_exprsn profile image
Muhammad Iliyas

May I please know what exactly the above command does ?

Collapse
 
esafb52 profile image
Masiha Ahmadi • Edited

i like this:
git update-index --assume-unchanged filename

Collapse
 
pandaquests profile image
Panda Quests

Awesome. Never used it before. Will try. Thanks for sharing