Git step by step
Create an empty directory: directoryname
$ mkdir directoryname
$ cd directoryname
Create a directoryname.html file in it
$ touch directoryname.html
Create a repository
$ git init
Add the page to the repository
$ git add directoryname.html
$ git commit -m "First Commit to directoryname"
Check the status of the repository
$ git status
Changing the “directoryname.html” page
$ start notepad++ directoryname.html
Check the working directory’s status.
$ git status
Adding changes
$ git add directoryname.html
$ git status
Staging and committing
$ git add directoryname.html
$ git commit -m "Changes directoryname.html <h1>Hello, World!</h1>"
Commiting the changes
$ git commit
# your editor opens
# On the first line, enter the comment: “Added hi tag”.
$ git commit
Checking the status
$ git status
# The working directory is clean, you can continue working.
Change the “directoryname.html” page so that it contained default tags <html> and <body>.
$ start notepad++ directoryname.html
<html>
<body>
<h1>Hello, World!</h1>
</body>
</html>
$ git add directoryname.html
Now add the HTML headers (<head> section) to the “directoryname.html” page.
$ start notepad++ directoryname.html
<html>
<head>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
$ git status
Commit
Commit the staged changes (default values), then check the status one more time.
$ git commit -m "Added standard HTML page tags"
$ git status
Adding the second change
$ git add .
$ git status
Commit the second change
$ git commit -m "Added HTML header"
History: Getting a list of changes made is a function
$ git log
One line history
$ git log --pretty=oneline
Options to choose which entreis appear in the log.
git log --pretty=oneline --max-count=2
git log --pretty=oneline --since=20.minutes-ago
git log --pretty=oneline --until=5.minutes-ago
git log --pretty=oneline --author=<your name>
git log --pretty=oneline --all
git log --pretty=oneline --since=20.minutes-ago
git log --pretty=oneline --until=5.minutes-ago
Getting fancy
$ git log --all --pretty=format:"%h %cd %s (%an)" --since='7.days-ago'