Date: Wed Apr 3 20:47:48 2019 -0500
Change up the order a bit.
...more of same from above...
```
---
## Who decided line 9 should be strange?!
`git blame`
```powershell
PS C:\Users\edthe\edthedev.github.io> git blame .\index.html
```
```powershell
3cbc7b3a (Edward Delaporte 2015-07-25 11:45:35 -0500 1)
3cbc7b3a (Edward Delaporte 2015-07-25 11:45:35 -0500 2)
e2e4117f (Edward Delaporte 2017-05-06 00:37:46 +0000 3)
e2e4117f (Edward Delaporte 2017-05-06 00:37:46 +0000 4)
e2e4117f (Edward Delaporte 2017-05-06 00:37:46 +0000 5)
e2e4117f (Edward Delaporte 2017-05-06 00:37:46 +0000 6)
e2e4117f (Edward Delaporte 2017-05-06 00:37:46 +0000 7)
4bf3f64c (Edward Delaporte 2017-05-06 05:10:05 +0000 8)
7cf65857 (Edward Delaporte 2015-07-25 12:19:15 -0500 12)
3cbc7b3a (Edward Delaporte 2015-07-25 11:45:35 -0500 13)
```
???
+ Each line of the file.
+ Who last modified each line.
+ When last modified each line.
---
## How to protect `master`
```
#!/bin/sh
branch="$(git rev-parse --abbrev-ref HEAD)"
(At the repo)
Create file .git/hooks/pre-commit with following content:
if [ "$branch" = "master" ]; then
echo "You can't commit directly to master branch"
exit 1
fi
```
Make it executable (not required on Windows):
```
$ chmod +x .git/hooks/pre-commit
```
[Full solution at Stack Overflow][10]
[10]: https://stackoverflow.com/questions/40462111/git-prevent-commits-in-master-branch
???
+ Git hooks are just shell scripts.
+ You can and should do more with them.
+ You can make your chat bot cuss out whoever broke the build or forgot to comment.
---
## What else can `git diff` do?
[Quite a bit][2]
[2]: https://git-scm.com/docs/git-diff
```
git diff [
] [] [--] […]
git diff [] --cached [] [--] […]
git diff [] [--] […]
git diff []
git diff [] --no-index [--]
```
???
- Diff can do more
- but the default target is the last commit
---
# Sometimes Surprising Results of Git Revert
## git commit {first commit}
## git commit {second commit}
---
# Sometimes Surprising Results of Git Revert
## git commit {third commit}
## git revert {third commit}
???
- As expected, we went back in time to a previous state.
+ The Revert Revert pattern - today's stupid mistake is tomorrow's 'good enough'
---
# Sometimes Surprising Results of Git Revert
## git commit {third commit}
## git revert { second commit }
???
- Surprise - this state has never existed in history.
---