πŸ’What IS git cherry-pick? πŸ’

Subscribe to my newsletter and never miss my upcoming articles

What is cherry-pick

git-cherry-pick - Apply the changes introduced by some existing commits

git-scm.com/docs/git-cherry-pick

$ git cherry-pick [--edit] [-n] [-m parent-number] [-s] [-x] [--ff]
          [-S[<keyid>]] <commit>…​
$ git cherry-pick (--continue | --skip | --abort | --quit)

[Use case] You are working on a branch from develop and your co-worker is also working on a branch from develop. He/She has fixed an issue(commit ID xxxyyyzzz000). You want to take in that bug fix from his/her branch, but you don't want to take in some commit he/she did.

Diff between merge and cherry-pick

Alt Text

$ git cherry-pick 61240658a3f26bd3b69cb961de4da9ef363fff35 # commit ID

How to check commit ID

  1. you can check it from log ```zsh $ git log

commit 61240658a3f26bd3b69cb961de4da9ef363fff35 Author: Koji <> Date: Thu Sep 24 16:41:16 2020 -0400

Update programming.py

commit d85d4ddc01f2a28205c3e57abe8fe38f378f4857 Author: Koji <> Date: Thu Sep 24 14:54:23 2020 -0400

Update programming.py

`` By the way, basically, you don't need the entire commit ID. You just need around6 digits` from the end that GitHub shows on a repo.

  1. you can check it on GitHub/Gitlab etc

Go to your repo and check your commits on a branch Alt Text

Β 
Share this
Proudly part of