You figured out diff just fine - differences between two files and/or directories. Read the man page for more info: man diff
As for git, that is an entirely different animal. There are a number of source control / configuration management systems available for Linux and other operating systems, such as (starting with oldest/least-used) SCCS, CVS, SVN, and GIT in the open source world, and proprietary ones such as ClearCase and AccuRev, et al. The purpose of these tools is to store versions of software and associated files on a versioning basis, so you can look at the differences between version A and version B for example, and roll back components with introduced bugs / unwanted features. These are some of the most important tools in software engineering environments.