Skip to content

Instantly share code, notes, and snippets.

@lnksz
Last active May 12, 2022 13:36
Show Gist options
  • Save lnksz/c709b0bad2262507c5f02cd5785e3a08 to your computer and use it in GitHub Desktop.
Save lnksz/c709b0bad2262507c5f02cd5785e3a08 to your computer and use it in GitHub Desktop.
Update a modified LTS kernel branch to a newer tag in linux-A.B.y

Illustrated git commands

Go to branch which we want to rebase

$ git checkout patched-v5.4.y

Where are we at?

$ git describe
v5.4.175-44-g5deadbeef

Where do we want to be (e.g. here the latest, or manual look-up at e.g. manjaro's adaption)

$ git describe origin/linux-5.4.y
v5.4.193

👉 Using single rebase command (we could do it interactively if we want to modify the commits)

$ git rebase --onto v5.4.193 v5.4.175 patched-v5.4.y 

See also the git rebase documentation with ASCII art:

   --onto.

   First let’s assume your topic is based on branch next. For example, a feature
   developed in topic depends on some functionality which is found in next.

           o---o---o---o---o  master
                \
                 o---o---o---o---o  next
                                  \
                                   o---o---o  topic

   We want to make topic forked from branch master; for example, because the
   functionality on which topic depends was merged into the more stable master branch.
   We want our tree to look like this:

           o---o---o---o---o  master
               |            \
               |             o'--o'--o'  topic
                \
                 o---o---o---o---o  next

   We can get this using the following command:

       git rebase --onto master next topic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment