Câu hỏi phỏng vấn Git
Câu hỏi

What is git cherry-pick ?

Câu trả lời

Git cherry-pick is a command used to apply a specific commit from one branch to another. This is particularly useful when you want to incorporate a single change or a few specific changes from one branch into another without merging the entire branch.

Key Points about Git Cherry-Pick:

  1. Definition: Cherry-picking in Git means selecting a commit from one branch and applying it to another branch[1][2][3][4][5].

  2. Usage Scenarios:

    • Bug Fixes: Apply a bug fix from a feature branch to the main branch without merging all the feature branch changes[2].
    • Feature Isolation: Move a specific feature commit to another branch for testing or deployment[2].
    • Backporting: Apply a commit from a newer branch to an older branch to backport a fix or feature[2].
  3. Command Syntax:

    • Basic usage: git cherry-pick <commit-hash>[1][2][3][4][5].
    • To include the original commit message: git cherry-pick -x <commit-hash>[1].
  4. Steps to Cherry-Pick:

    • Identify the commit hash you want to cherry-pick using git log[2].
    • Switch to the target branch using `git checkout <t...
middle

middle

Gợi ý câu hỏi phỏng vấn

junior

What is the difference between git pull and git fetch ?

middle

Could you explain the Gitflow workflow?

middle

What is a "bare git" repository?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào