Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
|
wiki2:gitlist [2020/04/25 15:53] alfred [Gitea] |
wiki2:gitlist [2020/08/25 17:39] (actual) |
||
|---|---|---|---|
| Línea 88: | Línea 88: | ||
| $ git release 0.1.0 -m <+ powerful feature added> | $ git release 0.1.0 -m <+ powerful feature added> | ||
| </code> | </code> | ||
| + | |||
| + | ==== Patches ==== | ||
| + | |||
| + | Create a file with changes: | ||
| + | |||
| + | * Create a git patch for each changed file: ''git format-patch <target-branch>'' | ||
| + | * Create only one git patch file with all changes: ''git format-patch <target-branch> --stdout patch_name.patch'' | ||
| + | * Create a path from a commit: ''git format-patch -1 <commit-hash>'' | ||
| + | * Show the path changes: ''git apply --stat <patch_file_path>'' | ||
| + | * Apply the path: ''git apply <patch_file_path>'' | ||
| + | * Apply the path and create a commit: ''git am <patch_file_path>'' | ||
| + | |||
| + | ===== pre-commit ===== | ||
| + | |||
| + | * https://pre-commit.com/ | ||
| + | * https://ljvmiranda921.github.io/notebook/2018/06/21/precommits-using-black-and-flake8/ | ||
| + | * https://black.readthedocs.io/en/stable/version_control_integration.html | ||
| + | * https://github.com/pre-commit/pre-commit-hooks#no-commit-to-branch | ||
| + | |||
| + | Install: | ||
| + | <code> | ||
| + | sudo pip3 install pre-commit | ||
| + | </code> | ||
| + | |||
| + | To use it with black, add this to .pre-commit-config.yaml: | ||
| + | <code> | ||
| + | repos: | ||
| + | - repo: https://github.com/psf/black | ||
| + | rev: stable | ||
| + | hooks: | ||
| + | - id: black | ||
| + | language_version: python3.8 | ||
| + | </code> | ||
| + | |||
| + | Then to set up the git hook scripts | ||
| + | <code> | ||
| + | run pre-commit install | ||
| + | </code> | ||
| + | Now pre-commit will run automatically on git commit! | ||
| + | <code> | ||
| + | pre-commit run --all-files | ||
| + | </code> | ||
| + | |||
| + | ===== Git Hooks ===== | ||
| + | * https://githooks.com/ | ||
| + | * https://github.com/aitemr/awesome-git-hooks | ||
| + | * https://itnext.io/using-git-hooks-to-enforce-branch-naming-policy-ffd81fa01e5e | ||
| + | * https://www.devwithimagination.com/2020/04/13/git-commit-hooks-for-branch-naming-pre-commit/ | ||
| + | |||
| + | |||