The classic expression of "saving" is similar to the Git term "committing". Git committing is an operation that saves a set of files, directories and their changes to the repository. Git commits can be created locally, then pushed to a remote server as needed with the help of the git push command. While saving changes in Git, you will have to deal with various commands, that are described below.
The git add is a command, which adds changes in the working directory to the staging area.With the help of this command, you tell Git that you want to add updates to a certain file in the next commit. But in order to record changes, you need to run git commit too.
The git commit command saves all currently staged changes of the project. Commits are created to capture the current state of a project. Committed snapshots are considered safe versions of a project because Git asks before changing them. Before running git commit command, git add command is used to promote changes to the project that will be then stored in a commit.
The git diff is a multi-function Git command, which is used to compare changes committed in Git. Particularly, with the help of this command you can take two input data sets and output the modifications between them.
The git stash command shelves changes you have made to your working copy so you can do another work, and then come back and re-apply them.
Git ignore files are located in a file called .gitignore. They are edited and committed by hand, as a git ignore command doesn’t exist. Git ignore files contain patterns matched against file names, with the help of which you decide to ignore or not each file.
Practice Your Knowledge
Quiz Time: Test Your Skills!
Ready to challenge what you've learned? Dive into our interactive quizzes for a deeper understanding and a fun way to reinforce your knowledge.