The method of saving file or a collection of files is whole lot different process in git than in a file editor.In order to save the latest versions of git project we will use the following commands:
- git add
- git status
- git commit
git add is an informant command.It acts as an intermediate between the user and git. It informs the git that changes are to be included in the next stage.It does not affect the repository until and unless git commit command is called.
As the name suggest, this command displays the state of working area and staging area.It displays the paths in working directory and lists the files which are tracked or untracked. This command is very helpful as it let the user know what he is doing before actually committing changes that he does not want to.
This command captures the changes.This command along with git add is one of the mst frequently used command. Git commit and git add are the commands which go along with each other.
Following are some important options of git commit command:
- -m “message
- -am “message”
It includes all currently changed files in this commit, but new untracked files are not affected.
This creates a commit command with a displayed message.This command by default opens a locally configured text editor.
This is the shortcut command that combines -a and -m options.
This option enable the user the amend the last commit. If user do not specify commit message with -m he/she will be prompted with message of previous commit command by default. This commands does not create a new commit but ecits the last.
Below are the snapshots of how above commands works
*Creating a python file
*Using git add, git status, git commit commands in our first commit
*Changing or updating the Number.py file in IDLE and saving it
*Again using git add, git status, git commit commands in our Second commit
Git add and git commit commands are the core commands. git add is used to tell the changes that needs to be staged for the next commit command.Then git commit is used to snapshot the staged changes.Git status is used to provide the state of staging area.
- Saving an Image from URL in PHP
- Saving What Saves Our Passwords – Two-Factor Authentication
- Saving Operated Video from a webcam using OpenCV
- How to get file input by selected file name without path using jQuery ?
- robots.txt File
- How to include one CSS file in another?
- How to get file name from a path in PHP?
- PHP | php.ini File Configuration
- How to delete a file using PHP ?
- Download file from URL using PHP
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.