Git - Part 3: Status and Log
Check git status
git status
Check git log
git log
One-line git log
git log --pretty=oneline
One-line git log with short hash id's
git log --oneline
Show the latest commit for current branch
git branch -v
Check git status
git status
Check git log
git log
One-line git log
git log --pretty=oneline
One-line git log with short hash id's
git log --oneline
Show the latest commit for current branch
git branch -v
Initialize a new Git repository
git init
Stage Single file
git add index.html
Stage Multiple files
git add index.html index2.html
Stage All (new, modified, deleted) files
git add -A
Stage All (new, modified, deleted) files
git add --all
Stage All (new, modified, deleted) files
git add .
Stage Modified and Deleted files only
git add -u
Stage New and Modified files only
git add --ignore-removal .
Commit to repository
git commit -m "This is commit message"
touch index.html
git add index.html
git status
vi index.html
git status
git commit -m "Initial commit"
git status
git add index.html
git commit -m "Content is changed"
git status
git log
Global configuration is stored in a file .gitconfig your root (cd ~) folder.
Set your name
git config --global user.name = 'John Doe'
Set your e-mail
git config --global user.email = 'info@yourdomain.com'
Set default editor, which will be used for commit messages, resolving conflicts, etc.
git config --global core.editor vi
OR
git config --global core.editor notepad
Turn off a warning about LF replacement
git config --global core.autocrlf true