Git commit

git commit is used to take a snapshot of the project’s currently staged changes. Commits are the core building block units of a Git project timeline. Commits are created with the git commit command to capture the state of a project at that point in time. Git Snapshots are always committed to the local repository. 

You can have multiple commits on local. When you are ready, you can then push your local commits to remote with git push

// add certain files(index.html) to commit
git add index.html

// or add all updated files to commit
git add .

// commit a snapshot of all changes in local repo
git commit -a

//By default, git commit will open up the locally configured text editor to add a commit message.
//Passing the -m option will forgo the text editor prompt in-favor of an inline message.
git commit -m "setup"

// create a commit of all the staged changes and takes an inline commit message.
// shortcut for (git add .) + (git commit -m "message")
git commit -am "setup"

 




Subscribe To Our Newsletter
You will receive our latest post and tutorial.
Thank you for subscribing!

required
required


Leave a Reply

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