Git Cherrypick and Git Patch are powerful tools used to selectively apply changes from one branch or commit to another without merging entire branches.
git cherrypick allows you to pick a specific commit from one branch and apply it to another branch without merging all commits.
// Apply a specific commit to the current branch
git cherrypick <commit-hash>
// Stage resolved files after conflict
git add file-name
// Continue cherrypick after resolving conflicts
git cherrypick --continue
// Abort cherrypick and rollback changes
git cherrypick --abort
A Git patch is a file containing differences between commits, useful for sharing or applying changes independently.
// Create a patch file between two commits
git diff commit1 commit2 > my-patch.patch
// Apply patch without committing
git apply my-patch.patch
// Apply patch and create commit
git am my-patch.patch