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 What Saves Our Passwords – Two-Factor Authentication
- Saving Operated Video from a webcam using OpenCV
- Saving an Image from URL in PHP
- How to install, configure and use GIT on ubuntu?
- GIT | An Introduction to Github
- How to use GIT in Ubuntu ? (Part -2)
- An Ultimate Guide to Git and Github
- Introduction and Installation of Git
- Git- Setting up a Repository
- Overturning Changes In Git
- Git- Debugging
- Examining Git
- Git - Changing History
- Introduction to Git Branch
- Git-Checkout And Merge
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.