Pergunta de entrevista da empresa EPAM Systems

Q: When using git, what is the difference between rebasing and merging, and in which situation would you use rebase over merging (and vice versa)?