43 lines
795 B
Markdown
43 lines
795 B
Markdown
# 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
|
|
|
|
`git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch logbook.md" HEAD `
|
|
|
|
|
|
## example de déclencheur git
|
|
|
|
```
|
|
#!/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
|
|
|
|
``` |