← All posts

By frank.bailey.jr ·August 5, 2026· 2 min read

Day ๐Ÿฎ๐Ÿด of the ๐Ÿญ๐Ÿฌ๐Ÿฌ ๐——๐—ฎ๐˜†๐˜€ ๐—ผ๐—ณ ๐——๐—ฒ๐˜ƒ๐—ข๐—ฝ๐˜€ ๐—–๐—ต๐—ฎ๐—น๐—น๐—ฒ๐—ป๐—ด๐—ฒ from KodeKloud

devopsgitmlopskodekloud

Day ๐Ÿฎ๐Ÿด of the ๐Ÿญ๐Ÿฌ๐Ÿฌ ๐——๐—ฎ๐˜†๐˜€ ๐—ผ๐—ณ ๐——๐—ฒ๐˜ƒ๐—ข๐—ฝ๐˜€ ๐—–๐—ต๐—ฎ๐—น๐—น๐—ฒ๐—ป๐—ด๐—ฒ from KodeKloud. Today's task was committing a change using Git Cherry Pick.

Here's the scenario. You are working on a branch of a repo. You have been developing and pushing commits, like a good diligent developer should. But a key component needs to pushed to the main branch, but you can't push up and merge your entire branch because it's not ready. What do you do, hotshot?

Answer: Use Git's Cherry Pick feature

With Git's Cherry Pick feature, you can choose a specific commit and push it directly to the main branch.

Before we start, here's the requirement for this task: โ€ข One of the developers is working on the ๐—ณ๐—ฒ๐—ฎ๐˜๐˜‚๐—ฟ๐—ฒ branch and their work is still in progress, however they want to merge one of the commits from the feature branch to the main branch, the message for the commit that needs to be merged into main is "๐—จ๐—ฝ๐—ฑ๐—ฎ๐˜๐—ฒ ๐—ถ๐—ป๐—ณ๐—ผ.๐˜๐˜…๐˜". Accomplish this task for them, also remember to push your changes eventually โ€ข The repo is cloned at /๐˜‚๐˜€๐—ฟ/๐˜€๐—ฟ๐—ฐ/๐—ธ๐—ผ๐—ฑ๐—ฒ๐—ธ๐—น๐—ผ๐˜‚๐—ฑ๐—ฟ๐—ฒ๐—ฝ๐—ผ๐˜€

Here were the steps I took to complete this task.

  1. CD in the correct directory

  2. Find the Commit Hash of the commit you want to copy. I used ๐š๐š’๐š ๐š•๐š˜๐š ๐šŠnd found the hash starting with 448b: [๐šž๐šœ๐šŽ๐š›@๐šœ๐š๐šœ๐š๐š˜๐š›๐Ÿถ๐Ÿท ๐šŽ๐šŒ๐š˜๐š–๐š–๐šŽ๐š›๐šŒ๐šŽ]$ ๐šœ๐šž๐š๐š˜ ๐š๐š’๐š ๐š•๐š˜๐š ๐šŒ๐š˜๐š–๐š–๐š’๐š ๐Ÿบ๐Ÿบ๐Ÿพ๐š‹๐š๐š‹๐š๐Ÿป๐š๐š๐šŒ๐š๐Ÿธ๐Ÿฟ๐Ÿธ๐Ÿธ๐Ÿธ๐Ÿฝ๐Ÿบ๐Ÿธ๐Ÿน๐Ÿฟ๐šŽ๐Ÿน๐Ÿผ๐Ÿพ๐š‹๐Ÿถ๐Ÿพ๐š๐Ÿท๐šŠ๐Ÿผ๐Ÿท๐Ÿพ๐Ÿฟ๐Ÿผ๐Ÿท๐š๐Ÿฟ ๐™ฐ๐šž๐š๐š‘๐š˜๐š›: ๐™ฐ๐š๐š–๐š’๐š— <๐šŠ๐š๐š–๐š’๐š—@๐š”๐š˜๐š๐šŽ๐š”๐š•๐š˜๐šž๐š.๐šŒ๐š˜๐š–> ๐™ณ๐šŠ๐š๐šŽ: ๐šƒ๐šž๐šŽ ๐™ฐ๐šž๐š ๐Ÿบ ๐Ÿท๐Ÿบ:๐Ÿน๐Ÿป:๐Ÿป๐Ÿน ๐Ÿธ๐Ÿถ๐Ÿธ๐Ÿผ +๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ

    ๐š„๐š™๐š๐šŠ๐š๐šŽ ๐š’๐š—๐š๐š˜.๐š๐šก๐š

  3. Switch to the Main Branch, ๐š๐š’๐š ๐š™๐šž๐š•๐š•, and cherry pick the commit. You have to be in the main branch to ๐šŒ๐š‘๐šŽ๐š›๐š›๐šข ๐š™๐š’๐šŒ๐š” a commit from another branch. The command is ๐š๐š’๐š ๐šŒ๐š‘๐šŽ๐š›๐šข-๐š™๐š’๐šŒ๐š” ๐š– ๐Ÿท <๐š‘๐šŠ๐šœ๐š‘>: [๐šž๐šœ๐šŽ๐š›@๐šœ๐š๐šœ๐š๐š˜๐š›๐Ÿถ๐Ÿท ๐šŽ๐šŒ๐š˜๐š–๐š–๐šŽ๐š›๐šŒ๐šŽ]$ ๐š๐š’๐š ๐šŒ๐š‘๐šŽ๐š›๐š›๐šข-๐š™๐š’๐šŒ๐š” -๐š– ๐Ÿท ๐Ÿบ๐Ÿบ๐Ÿพ๐š‹๐š๐š‹๐š๐Ÿป๐š๐š๐šŒ๐š๐Ÿธ๐Ÿฟ๐Ÿธ๐Ÿธ๐Ÿธ๐Ÿฝ๐Ÿบ๐Ÿธ๐Ÿน๐Ÿฟ๐šŽ๐Ÿน๐Ÿผ๐Ÿพ๐š‹๐Ÿถ๐Ÿพ๐š๐Ÿท๐šŠ๐Ÿผ๐Ÿท๐Ÿพ๐Ÿฟ๐Ÿผ๐Ÿท๐š๐Ÿฟ [๐š–๐šŠ๐š’๐š— ๐š๐š๐šŠ๐š๐Ÿบ๐š‹๐Ÿธ] ๐š„๐š™๐š๐šŠ๐š๐šŽ ๐š’๐š—๐š๐š˜.๐š๐šก๐š ๐™ณ๐šŠ๐š๐šŽ: ๐šƒ๐šž๐šŽ ๐™ฐ๐šž๐š ๐Ÿบ ๐Ÿท๐Ÿบ:๐Ÿน๐Ÿป:๐Ÿป๐Ÿน ๐Ÿธ๐Ÿถ๐Ÿธ๐Ÿผ +๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ ๐Ÿท ๐š๐š’๐š•๐šŽ ๐šŒ๐š‘๐šŠ๐š—๐š๐šŽ๐š, ๐Ÿท ๐š’๐š—๐šœ๐šŽ๐š›๐š๐š’๐š˜๐š—(+), ๐Ÿท ๐š๐šŽ๐š•๐šŽ๐š๐š’๐š˜๐š—(-)

  4. Afterwards, ๐š๐š’๐š ๐š™๐šž๐šœ๐š‘ the cherry picked commit: [๐šž๐šœ๐šŽ๐š›@๐šœ๐š๐šœ๐š๐š˜๐š›๐Ÿถ๐Ÿท ๐šŽ๐šŒ๐š˜๐š–๐š–๐šŽ๐š›๐šŒ๐šŽ]$ ๐šœ๐šž๐š๐š˜ ๐š๐š’๐š ๐š™๐šž๐šœ๐š‘ ๐™ด๐š—๐šž๐š–๐šŽ๐š›๐šŠ๐š๐š’๐š—๐š ๐š˜๐š‹๐š“๐šŽ๐šŒ๐š๐šœ: ๐Ÿป, ๐š๐š˜๐š—๐šŽ. ๐™ฒ๐š˜๐š–๐š™๐š›๐šŽ๐šœ๐šœ๐š’๐š—๐š ๐š˜๐š‹๐š“๐šŽ๐šŒ๐š๐šœ: ๐Ÿท๐Ÿถ๐Ÿถ% (๐Ÿธ/๐Ÿธ), ๐š๐š˜๐š—๐šŽ. ๐š†๐š›๐š’๐š๐š’๐š—๐š ๐š˜๐š‹๐š“๐šŽ๐šŒ๐š๐šœ: ๐Ÿท๐Ÿถ๐Ÿถ% (๐Ÿน/๐Ÿน), ๐Ÿน๐Ÿท๐Ÿบ ๐š‹๐šข๐š๐šŽ๐šœ | ๐Ÿน๐Ÿท๐Ÿบ.๐Ÿถ๐Ÿถ ๐™บ๐š’๐™ฑ/๐šœ, ๐š๐š˜๐š—๐šŽ. ๐šƒ๐š˜๐š๐šŠ๐š• ๐Ÿน (๐š๐šŽ๐š•๐š๐šŠ ๐Ÿถ), ๐š›๐šŽ๐šž๐šœ๐šŽ๐š ๐Ÿถ (๐š๐šŽ๐š•๐š๐šŠ ๐Ÿถ), ๐š™๐šŠ๐šŒ๐š”-๐š›๐šŽ๐šž๐šœ๐šŽ๐š ๐Ÿถ (๐š๐š›๐š˜๐š– ๐Ÿถ) ๐šƒ๐š˜ /๐š˜๐š™๐š/๐šŽ๐šŒ๐š˜๐š–๐š–๐šŽ๐š›๐šŒ๐šŽ.๐š๐š’๐š ๐Ÿผ๐Ÿบ๐Ÿท๐Ÿบ๐Ÿธ๐Ÿธ๐Ÿท..๐š๐š๐šŠ๐š๐Ÿบ๐š‹๐Ÿธ ๐š–๐šŠ๐š’๐š— -> ๐š–๐šŠ๐š’๐š—

I hope you found this informative! More to come!