git: Interactive adding of files

I’ve decided that for my own sake I should record the things I need to remember in using git. However, I use git primarily at work, and I’m currently at home (it being a Saturday night this is hardly a surprise) so there’s not much to note for my own needs right now.

So, seeing as my compadré Andy had never seen this (and he’s well boffin at git generally) I thought my initial gitly post could be this…

git add -i

This gives you an interactive prompt for adding files in git. Little menu and everything. It’s dead good. Press ’2′ to add files, and then select the files you want to add by number. It understands ranges, so entering 1-7,9 will add 1-9 excluding 8.