GIT COMMIT :- Save changes in stage area

GIT COMMIT:- Git commit command commits the staged snapshots to the project history. Whenever you do git commit it will commit the changes into staged area but not on server to send your changes to server you should you git push command.
To commit specific files we should use file path with commit. always be sure before using -a (all) flag. This will commit all files some may be needed some may not for your repository. -m flag is always required if you don’t pass it in command it will open your preferred editor asking for the message. If any file is new you should add file first using git add command. We can use git status command at any time to see what the project status is. –amend flag is very useful when you forgot to commit any file this will add the current files is last commit with same message as last commit is. you can also change the message.

Git Commit Command

#commit staged snapshot
git commit

#commit staged snapshot without launching the text editor asking for message
git commit -m 

#commit all changes to working dirctory with all modified files.
git commit -a

#add the changes to last commit
git commit --amend

Leave a Reply

Your email address will not be published. Required fields are marked *