Junior — Middle
What change is applied to the commit history when executing the git rebase command?
sobes.tech AI
Answer from AI
The git rebase command rewrites commit history by transferring one branch onto another. This creates new commits with new hashes, as if the changes were made on top of a different branch.
Main changes:
- The history becomes linear, without additional branching.
- Commits are rewritten with a new base, which changes their identifiers.
Example:
If you have a branch feature, branched off from master, and you run git rebase master on the feature branch, all commits in feature will be "rewritten" as if they were made on top of the latest commit of master.
This is convenient for maintaining a clean history, but requires caution when working with public branches to avoid conflicts with other developers.