Archives: November 2014
I have slightly different i3 configuration files between my desktop and laptop computers. In this case, the laptop keyboard is missing a Play/Pause multimedia key. This is where the two files differ: the laptop has a different key binding for running the music player.
Having recently added new key bindings to the desktop configuration, I wanted to merge those new lines into the laptop configuration file, without overwriting its specific lines. After trials and errors and thanks to precious clues found on the Internet, I found the patch flag of git-checkout. From the branch specific to my laptop configuration, I ran:
$ git checkout -p master .config/i3/config
This displays an output similar to git-diff, based on the local file .config/i3/config and the one in the branch 'master'. For each conflicts, Git asks:
Apply this hunk to index and worktree [y,n,q,a,d,/,j,J,g,e,?]?
I answered 'n'o to preserve the part specific to the laptop, and 'y'es for the new key bindings I wanted to copy.