Code projects are required to have a .gitignore file in the root directory of the repository. The .gitignore file specifies which files and directories should be ignored by Git version control. This is important to prevent unnecessary files, such as build artifacts, temporary files, and sensitive information, from being tracked in the repository.
The following applies to all programming courses unless otherwise noted. Note that COSC 2325 Computer Organization / Machine Language and COSC 3301 Programming Languages do not count as programming courses for purposes of best practices and version control usage. Non-programming courses will have class specific guidelines provided by the instructor.
[ companion video ]
git add,
always name the files you wish to add explicitly.
Such as git add file.ext for one file or
git add file1.ext file2.ext for multiple files.
These two steps work together to help you maintain a clean and secure project repository. By never using wildcards with git add, you ensure that only the files you intend to include in your repository are added. Then the .gitignore file acts as a safeguard by specifying which files and directories can't be added. While both steps are subject to human error, using them in combination significantly reduces the likelihood of mistakes.
Tips for creating effective .gitignore files: