Is .profile or .bashrc backed up anywhere automatically?
No, there is no special handling of .profile, .bashrc or any other config file within OS X. So unless you are running a regular backup (e.g. using Time Machine), these files will be lost if you type &gt; instead of &gt;&gt;.

Some of-the-top-of-the-head ideas to overcome this


run a regular backup (there are probably files on your computer which are more important than .profile so you should be doing this anyway)
change habits and use the text editor of your choice to update shell profiles
create a shell function to do the append operation, e.g. something like this (untested)

add_to_profile() {
    echo &gt;&gt; ~/.profile
    echo '# ' Added on $(date) &gt;&gt; ~/.profile
    echo $* &gt;&gt; ~/.profile
}


and use it like add_to_profile 'export foo=bar'.
use Hazel (or Folder Actions) to backup .profile and .bashrc automatically after each change
put those files under version control (either locally or on Github)