This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- 1. Create the user role | |
| CREATE USER app_user PASSWORD 'secure_password'; | |
| -- 2. Give them access to the database | |
| GRANT CONNECT ON DATABASE ma_base TO app_user; | |
| -- 3. Give them access to the schema | |
| GRANT USAGE ON SCHEMA public TO app_user; | |
| -- 4. Give them privileges on the tables |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Replace the string "foo" by "bar" in all .yml files in the whole Git history | |
| git filter-branch -f --tree-filter "find . -type f -name '*.yml' -exec sed -i -e 's/foo/bar/g' {} \;" | |
| # Replace the string "foo" by "bar" in all files in the whole Git history | |
| git filter-branch -f --tree-filter "find . -type f -exec sed -i -e 's/foo/bar/g' {} \;" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Move/Rename folder "foo/my-old-folder" to "foo/my-new-folder" and keep history | |
| git filter-branch -f --tree-filter 'test -d foo/my-old-folder && mv foo/my-old-folder foo/my-new-folder || echo "Nothing to do"' HEAD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copied from https://stackoverflow.com/a/11426261/12560823 | |
| # Create git patch from the source repository | |
| cd repository | |
| git log --pretty=email --patch-with-stat --reverse --full-index --binary -- path/to/file_or_folder > patch | |
| # Apply previous git patch to the destination repository | |
| cd ../another_repository | |
| git am --committer-date-is-author-date < ../repository/patch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Tell to Git to ignore localy modifications that will be done on foo.txt | |
| git update-index --skip-worktree ${PWD}/foo.txt | |
| # Display ignored file | |
| git ls-files -v | |
| # Unset the ignore file | |
| git update-index --no-skip-worktree ${PWD}/foo.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Filter only specific commits and sign only them | |
| git filter-branch --commit-filter 'if [ "$GIT_COMMITTER_EMAIL" = "[email protected]" ]; | |
| then git commit-tree -S "$@"; | |
| else git commit-tree --no-gpg-sign "$@"; | |
| fi' HEAD | |
| git push --force |