Introduction
On this page, you will find out the synonym of "saving" in Git, learn the main principles, read short descriptions of Git commands used while saving changes.
The term "saving" in Git is referred to as "committing". Committing is an operation that records a snapshot of staged files and their changes to the repository. Git commits can be created locally, then pushed to a remote server as needed using the git push command. When saving changes in Git, you will use various commands, described below.

git add
The git add command adds changes from the working directory to the staging area. With this command, you tell Git that you want to include updates to specific files in the next commit. However, you must also run git commit to actually record the changes.
git add <file>
git add .git commit
The git commit command saves all currently staged changes for the project. Commits are created to capture the current state of a project. Committed snapshots are permanent records of the project's state at that point in time. Before running the git commit command, the git add command is used to stage changes that will then be stored in the commit.
git commit -m "Describe the changes"git diff
The git diff command is used to compare different states of your project. By default, git diff compares the working directory to the staging area. It shows the modifications between two sets of files, such as unstaged changes versus the staging area, or differences between commits.
git diff
git diff --stagedgit stash
The git stash command temporarily saves changes in your working directory so you can switch to another task, and later re-apply them.
git stash
git stash pop.gitignore
Git uses a file named .gitignore to specify files and directories that should be ignored. Since there is no dedicated git ignore command, this file is edited and committed manually. It contains patterns that tell Git which files to exclude from tracking. Common patterns for development environments include:
# Dependencies
node_modules/
# OS files
.DS_Store
Thumbs.db
Typical Workflow
A standard sequence for saving and sharing changes looks like this:
git add <file>
git commit -m "Initial commit"
git push origin mainThis stages modified files, records a permanent snapshot with a descriptive message, and uploads the commit to the remote repository.
Practice
What are the functions of various Git commands related to saving changes?