InterviewSolution
| 1. |
What is git rebase and how can it be used to resolve conflicts in a feature branch before the merge? |
|
Answer» In simple words, git REBASE allows one to move the first commit of a BRANCH to a new starting location. For example, if a feature branch created from the master branch, and in between if the master branch has received additional commits, git rebase can be used to move the feature branch to the tip of master. The COMMAND will integrate the changes made in the feature branch at the tip of the master, allowing conflicts to be resolved amicably. When it is done with care, this will always allow the feature branch to be merged into master seamlessly and sometimes as a simple fast-forward operation. Rebase compresses all the changes into a single “patch.” Then it integrates the patch onto the target branch. UNLIKE merging, rebasing flattens the history because it transfers the completed work from one branch to ANOTHER.you should never rebase commits once they've been pushed to a public repository. The rebase would replace the old commits with new ones. We can have a scenario where if we started doing some development and then another developer made an unrelated change. You probably want to pull and then rebase to base your changes from the current version from the repo. |
|