logo
Antony Jepson
🤔 About
✍️ Contact
21 Sep 2020
 

Selectively applying changes with Git Stash
21 January 2019

So you just spent 2 hours fixing a bug and made a bunch of other changes along the way. You took notes on your change and have a good mental model of what you did but you’re too lazy to walk through the changes and commit them individually.

This has happened to me a few times and resulted in some awry looking commits with dangling changes.

Turns out git has your back.

First, create a temporary branch that you’ll use to continue the tree of commits.

$ git branch staging-temp

Next, interactively apply the changes

$ git add -i

You can read the documentation for more tips on interactive mode: https://git-scm.com/book/en/v2/Git-Tools-Interactive-Staging.

Sometimes, I prefer to do this the other way around. I instead begin by stashing all the irrelevant changes and then iteratively merging them back into HEAD.

$ git stash save --patch

Don’t forget to merge the temporary branch back into main.

Upgrading to linux-2.6.27-rc2
8 August 2008

git makes it incredibly easy to upgrade my kernel to the latest (but not necessarily greatest). I’ve decided that I’ll stick to tagged releases instead of the latest git pull.

I’ll skip the prologue and just show the commands.

Download the latest commits.

linux-git %   git pull  (Note:  Make sure you are in the master branch 🙂 [git checkout master].)

Download the latest tags.

linux-git % git fetch –tags git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

List the current tags.

linux-git % git tag -l “v2.6.27*”

Duplicate the 2.6.27-rc2 branch, call it aj2.6.27-rc2, and switch to it.

linux-git % git checkout -b aj2.6.27-rc2 v2.6.27-rc2

Copy the current config to the kernel directory.

linux-git % zcat /proc/config > .config

Configure any options that changed in the latest version.

linux-git % make oldconfig

Go through the usual compilation steps. See my post on upgrading to 2.6.27-rc1 for more information.

linux-git % make | tee make.log
linux-git % su
pts/2:root@GENTOO /home/antony/proj/linux-git # make modules_install | tee modules.log
pts/2:root@GENTOO /home/antony/proj/linux-git # mkinitcpio -k `make kernelrelease` -g /boot/kernel-2.6.27-rc2.img
pts/2:root@GENTOO /home/antony/proj/linux-git # cp System.map /boot/System.map-2.6.27-rc2
pts/2:root@GENTOO /home/antony/proj/linux-git # cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.27-rc2
pts/2:root@GENTOO /home/antony/proj/linux-git # install -D -m644 .config /boot/kconfig-2.6.27-rc2
pts/2:root@GENTOO /home/antony/proj/linux-git # /sbin/depmod -A -v `make kernelrelease`
pts/2:root@GENTOO /home/antony/proj/linux-git # vim /boot/grub/menu.lst
pts/2:root@GENTOO /home/antony/proj/linux-git # reboot

Problems

Difficulty in setting up catalyst-8.7. See my post on upgrading to catalyst-8.7.

Notes: My kernel config

kconfig-2.6.27-rc2

Built with Wordpress and Vim
© 2008 to 2020 Antony Jepson