CodeBlanks Logo Icon CodeBlanks

Summary - Advanced cherry-pick

Combine advanced cherry-pick options to do bulk moves.

Combine Advanced Cherry-Pick Options

Advanced cherry-pick operations let you apply changes without creating a commit, transfer a range of commits, and select a merge strategy. -n prevents automatic commit creation, two-dot notation defines a commit range, and -s selects a strategy.

git cherry-pick -n abc1234
git cherry-pick abc1234..def5678
git cherry-pick -s ort abc1234

Practice Prepare Bulk Cherry-Pick Commands

Add three commands to the commands array in this order: apply commit 111aaaa without creating a commit, apply the range 222bbbb..888cccc, and apply commit 999dddd using the ort strategy. Print the array.

Starter code

terminal
// Toplu cherry-pick komutlarını tanımla

// Komutları yazdır

Sample solution

terminal
const commands = [
  "git cherry-pick -n 111aaaa",
  "git cherry-pick 222bbbb..888cccc",
  "git cherry-pick -s ort 999dddd"
];
console.log(commands);

Expected output

[
  'git cherry-pick -n 111aaaa',
  'git cherry-pick 222bbbb..888cccc',
  'git cherry-pick -s ort 999dddd'
]

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which command applies a commit range without creating commits automatically and uses the ort strategy?

  • git stash -n abc1234..def5678
  • git cherry-pick --graph abc1234..def5678
  • git cherry-pick -u ort abc1234..def5678
  • git cherry-pick -s ort abc1234..def5678 -n Correct answer

Explanation: The first command selects the commit range, prevents automatic commits with <code>-n</code>, and specifies the strategy with <code>-s ort</code>.

2 Complete the Bulk Application Command

Question
git cherry-pick -n ____
Answer
git cherry-pick -n 111aaaa..999bbbb

Explanation: Two-dot notation defines the range between the starting and ending commits. <code>-n</code> applies the changes without creating a new commit.

3 Advanced Cherry-Pick Parts

Term Meaning
-n Prevents automatic commit
abc..def Specifies a commit range
-s ort Selects the ort strategy
Commit kimliği Selected commit reference

All lessons in Advanced