How to squash or fixup commits?
Answer / Rajat Madan
To squash multiple commits into one, you can use the command `git rebase -i <base_branch>`. In the interactive mode, change 'pick' at the beginning of each commit you want to squash to 'squash', then save and exit. To fixup (amend the last commit), use `git rebase -i HEAD~<number_of_commits>` and change 'pick' to 'fixup!'.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is git fork? What is the difference between fork, branch, and clone?
How to revert previous commit in git?
What is a “conflict” in git and how is it resolved?
What is subgit and why is it used?
What is the purpose of branching and how many branching strategies can you apply?
What is GIT stash drop?
In git, how would you return a commit that has just been pushed and made open?
Distinguish between git fetch and git pull?
What is a commit message?
What is git reflog?
What are the different ways you can refer to a commit?
What is the use of ‘git log’?