Git beginner here. My colleague is going on holiday and I've to pick up (and finish and merge to master) his work in his absence. He has his feature branch (call it his_branch) with all his work. He cannot merge it to master as the changes are not complete yet and will break stuff in current form.
What will be the git workflow for this? How exactly can I get his changes? I want my branch to have his changes but then I want to commit everything to master, so slightly confused.
CodePudding user response:
You can get the changes from his branch with git-cherry-pick that applies the changes introduced by some existing commits.
You can check the commit number from his branch and then use the following in terminal:
- git checkout your_branch_name (move to your branch)
- git cherry-pick his_commit_number (something like 608bf269ce1002e18f8400b5cc5aff - to add his changes)
- git push (to push his changes in your branch)
You can create the PR from your branch in master when the work is done.
Or you can work and add more commits directly to his branch.