Question: If you have several commits for a single feature, what is the most efficient way to restructure your commit history?

  1. Use git stash to consolidate the commits under a new hash.
  2. Use git squash to consolidate the commits together into a single coherent commit.
  3. Delete the task commits and recommit with a new message.
  4. Use git cherry-pick to place the commits in another branch.

Answer: The correct answer of the above question is Option B:Use git squash to consolidate the commits together into a single coherent commit.