Junior — Middle
What is the role and purpose of the git rebase -i command in the branch workflow?
sobes.tech AI
Answer from AI
The git rebase -i command (interactive rebase) is used to modify the commit history in a branch. It allows:
- Reordering commits
- Squashing multiple commits into one
- Editing commit messages
- Deleting or skipping commits
This is useful for cleaning up history before merging branches to make it clearer and more logical.
Example usage:
git rebase -i HEAD~3
An editor will open with the last three commits, where you can specify actions for each.