Junior — Middle
How can changes be transferred from one branch to another in a version control system?
sobes.tech AI
Answer from AI
In version control systems like Git, changes from one branch to another can be transferred in several ways:
- Merge — combines the history of two branches, creating a new merge commit. Example:
git checkout target-branch
git merge source-branch
- Cherry-pick — allows selecting individual commits from one branch and applying them to another:
git checkout target-branch
git cherry-pick <commit-hash>
- Rebase — moves changes from one branch on top of another, rewriting history:
git checkout source-branch
git rebase target-branch
The choice of method depends on the desired history and the situation in the project.