Read more

Git: Apply a diff

Emanuel
July 02, 2019Software engineer at makandra GmbH

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

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

Example:

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.

Posted by Emanuel to makandra dev (2019-07-02 11:57)