Git Basics: Save and Review Changes in a Project
Git records project changes so you can review how files evolved and return to a known version. A commit is a local snapshot; pushing to a remote repository is a separate action.
What to do
- In a project folder, run
git statusto see changed and untracked files before staging anything. - Use
git add path/to/filefor specific reviewed files, then rungit diff --cachedto inspect exactly what will be committed. - Create a focused commit with
git commit -m "Describe the change". Use a message that summarizes the change rather than claiming it is complete or tested when it is not. - Run
git log --oneline -5to review recent commits. Configure a remote and use push only when you intend to publish those commits to the shared repository.
Checks and limitations
- Do not commit passwords, access tokens, private keys, or customer data. Remove exposed credentials and rotate them if they were already published.
- Git does not replace backups, and a local commit is not automatically copied to another computer.