There is a gem called license_header that has a tool for removing and adding license headers. It takes a text file like header.txt and adds it as a comment, changing the comment style for the different filetypes.
I used it like this
Things to look out for
Don't add headers to the files in the config directory.
The update overwrote one line of code that was a little too close to the header. Out of 328 updates, that's not bad, just something to look for.
I recommend committing in chunks. Github can only display so many changes before it cuts off the commit. Push up smaller commits, check your changes in the nice handy interface, then rebase and force push back to the branch you're using.