git commits code example

Example 1: how to see all commits in git

$ git log --pretty=format:"%h - %an, %ar : %s"
ca82a6d - Scott Chacon, 6 years ago : Change version number
085bb3b - Scott Chacon, 6 years ago : Remove unnecessary test
a11bef0 - Scott Chacon, 6 years ago : Initial commit

Example 2: git commit

git commit -a -m "The Commit message"

Example 3: git commit

git add index.html css/styles.css
git add .
git commit -m "Change titles and styling on homepage"

Example 4: to see all after commit in local repository in git

git log --name-only

Example 5: git commit

//now commit the code
git commit -m "anyMessageYouWantToWrite"

Example 6: how to commit changes in git command

git commit -a