DEV Community

Discussion on: Essential git commands

Collapse
 
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.

Collapse
 
abdulshakoor profile image
Shoukrey Tom • Edited

thank you

Collapse
 
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

Collapse
 
gustavopch profile image
Gustavo

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.