Posted 5 months ago. Visible to the public.

Git: Apply a diff

git apply allows you to apply a diff onto your HEAD. Most often you can achieve the same result with a rebase & merge.


master commit1 - commit3 feature-branch \ commit2 - commit4
git checkout feature-branch git reset --hard commit3 git diff ..commit4 | git apply
master commit1 - commit3 feature-branch \ Unstaged commit 2 & 4

You can also create a patch and apply it afterwards.

makandra has been working exclusively with Ruby on Rails since 2007. Our laser focus on a single technology has made us a leader in this space.

Owner of this card:

Emanuel De
Last edit:
5 months ago
by Emanuel De
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Emanuel De to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more