DEV Community

Discussion on: Essential git commands

bobnudd profile image
Ash Grennan

Great list, if I was to add one:

git cherry-pick [commit id here] incredibly useful to pick specific commits when you don't want the branch.

abdulshakoor profile image
Shoukrey Tom Author • Edited

thank you

tarunvella profile image
tarunvella • Edited

It is always better to use git checkout [commit id here || branch name] [filename of other branch] than cherry pick

gustavopch profile image

Not always better. They work differently:

  • cherry-pick will append the specified commit to the current one.
  • checkout will bring the specified commit's changes to the working directory (it's up to you to commit those changes).

It really depends on what you want to do. I use both frequently.