When Should One Commit Code?

Every time you have a small feature working you should commit.

How to Commit Tour Code??

  1. There are two ways to commit your code:
git pull origin master 
git checkout -b feature-branch 
git add . 
git commit -m "Describe your changes here" 
(optional to make sure is clean) git status 
git push origin feature-branch
  1. Another way to work with git is by using the following steps:
git pull origin master 
git checkout -b feature-branch 
git add . 
git commit -m "Describe your changes here" 
git checkout master 
git pull origin master 
git checkout feature-branch
git merge master  
git add . 
git commit -m "Merge master"
git push origin feature-branch 

Happy coding!