Always take a backup before doing anything major.
Also, you seem to be jumping a long release train. Either do an incremental upgrade as suggested in comments, or I'd personally recommend a fresh install.
Now that being said, files are file, regardless if they are git files, images or PDF. As long as you are keeping file in your home directory, or a separate partition, or anywhere else which is not considered a system directory, they should be safe.
For OS, a file is a file with some data in it. It is up to the program to make sense out of that data. git will understand files in a .git/ directory, and an image viewer will understand based on bit pattern in the file's preamble/header or file extension.
The OS doesn't care about what file types they are, and it wont touch them as long as they are outside system directories.
Do they have to be reinitialized or what is the process for making sure they are recognized by git on my local machine after upgrading Ubuntu distros?
No, you don't have to reinitialize anything. If you preserve your directory structure, you'll have .git directory in each of your projects, which is used by git to track.
Make sure that after update the following command work, if not then you have to reinstall git binaries (which I don't think will be a case you'll encounter)
git --version