2020-11-26 17:38:25 +00:00
|
|
|
# git
|
|
|
|
|
|
|
|
## delete a file only from git repository
|
|
|
|
|
|
|
|
`git rm -rf --cached`
|
|
|
|
|
|
|
|
## delete a file from complete history
|
|
|
|
|
|
|
|
be carefull can't push repo last time use
|
|
|
|
|
2020-11-26 18:27:32 +00:00
|
|
|
`git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch logbook.md" HEAD`
|
2020-11-26 17:38:25 +00:00
|
|
|
|
|
|
|
## example de déclencheur git
|
|
|
|
|
2020-11-26 18:27:32 +00:00
|
|
|
```bash
|
2020-11-26 17:38:25 +00:00
|
|
|
#!/bin/bash
|
|
|
|
GIT_REPO=`pwd`
|
|
|
|
SITE_NAME=notebook
|
|
|
|
TMP_GIT_CLONE="/tmp/$SITE_NAME"
|
|
|
|
PUBLIC_WWW="/usr/share/nginx/html/$SITE_NAME"
|
|
|
|
# get branch name
|
|
|
|
if ! [ -t 0 ]; then
|
|
|
|
read -a ref
|
|
|
|
fi
|
|
|
|
IFS='/' read -ra REF <<< "${ref[2]}"
|
|
|
|
branch="${REF[2]}"
|
|
|
|
|
|
|
|
if [ "master" == "$branch" ]; then
|
|
|
|
mkdir -p $TMP_GIT_CLONE
|
|
|
|
echo "download repo"
|
|
|
|
git clone --recursive $GIT_REPO $TMP_GIT_CLONE
|
|
|
|
cd $TMP_GIT_CLONE
|
|
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
|
|
make install -e BUILDDIR=$PUBLIC_WWW
|
|
|
|
echo "Cleaning up"
|
|
|
|
rm -Rf $TMP_GIT_CLONE
|
|
|
|
fi
|
|
|
|
exit
|
|
|
|
|
2020-11-26 18:27:32 +00:00
|
|
|
```
|