mirror of
https://github.com/linkedin/school-of-sre
synced 2026-01-10 10:38:02 +00:00
Remove shell prompt so shell commands are easier to read
This fixes this issue #83 I made this commit by running a find replace with the pattern '^.*spatel1\$' and replaced it with '$'
This commit is contained in:
committed by
Sanket Patel
parent
6100c9af50
commit
a605e72695
@@ -17,7 +17,7 @@ GitHub has written nice guides and tutorials about this and you can refer them h
|
||||
Git has another nice feature called hooks. Hooks are basically scripts which will be called when a certain event happens. Here is where hooks are located:
|
||||
|
||||
```bash
|
||||
spatel1-mn1:school-of-sre spatel1$ ls .git/hooks/
|
||||
$ ls .git/hooks/
|
||||
applypatch-msg.sample fsmonitor-watchman.sample pre-applypatch.sample pre-push.sample pre-receive.sample update.sample
|
||||
commit-msg.sample post-update.sample pre-commit.sample pre-rebase.sample prepare-commit-msg.sample
|
||||
```
|
||||
@@ -25,16 +25,16 @@ commit-msg.sample post-update.sample pre-commit.sample pr
|
||||
Names are self explanatory. These hooks are useful when you want to do certain things when a certain event happens. If you want to run tests before pushing code, you would want to setup `pre-push` hooks. Let's try to create a pre commit hook.
|
||||
|
||||
```bash
|
||||
spatel1-mn1:school-of-sre spatel1$ echo "echo this is from pre commit hook" > .git/hooks/pre-commit
|
||||
spatel1-mn1:school-of-sre spatel1$ chmod +x .git/hooks/pre-commit
|
||||
$ echo "echo this is from pre commit hook" > .git/hooks/pre-commit
|
||||
$ chmod +x .git/hooks/pre-commit
|
||||
```
|
||||
|
||||
We basically create a file called `pre-commit` in hooks folder and make it executable. Now if we make a commit, we should see the message getting printed.
|
||||
|
||||
```bash
|
||||
spatel1-mn1:school-of-sre spatel1$ echo "sample file" > sample.txt
|
||||
spatel1-mn1:school-of-sre spatel1$ git add sample.txt
|
||||
spatel1-mn1:school-of-sre spatel1$ git commit -m "adding sample file"
|
||||
$ echo "sample file" > sample.txt
|
||||
$ git add sample.txt
|
||||
$ git commit -m "adding sample file"
|
||||
this is from pre commit hook # <===== THE MESSAGE FROM HOOK EXECUTION
|
||||
[master 9894e05] adding sample file
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
Reference in New Issue
Block a user