QA
Intermediate LevelGit & GitHub

How do git format-patch and git am share commits via email patch files?

❓ Interview Prompt: Explain git format-patch, RFC-822 formatted email patch files, and applying patch sets using git am.

git format-patch exports commits as RFC-822 formatted email patch files (.patch), and git am applies patch files sequentially into repository history, preserving original authorship.

Code Implementation Example

bash
git format-patch -2 HEAD
git am 0001-feat-add-auth.patch
💡Exporting and applying email patch files using git format-patch and git am.
🎯 Interview Key Takeaway

Use git format-patch to export commits as email patch files, and git am to apply them into commit history.

#git format-patch#git am#Patches#Intermediate
Back to all Git & GitHub Questions→

More Git & GitHub Interview Questions

Beginner LevelGit & GitHub

Compare git rebase versus git merge and explain how git bisect finds regressions.

Beginner LevelGit & GitHub

What is the difference between git init and git clone?

Beginner LevelGit & GitHub

What are the Three Trees in Git (Working Directory, Staging Area / Index, Commit History)?