1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-08-04 22:35:45 +02:00
tldr/pages/common/git-sed.md
Managor ba6daef39d
*: standardize regex usage (#17328)
Co-authored-by: Dylan <145150333+dmmqz@users.noreply.github.com>
2025-07-25 08:50:06 +03:00

624 B

git sed

Replace patterns in git-controlled files using sed. Part of git-extras. More information: https://manned.org/git-sed.

  • Replace the specified text in the current repository:

git sed '{{find_text}}' '{{replace_text}}'

  • Replace the specified text and then commit the resulting changes with a standard commit message:

git sed -c '{{find_text}}' '{{replace_text}}'

  • Replace the specified text, using regex:

git sed -f g '{{find_text}}' '{{replace_text}}'

  • Replace a specific text in all files under a given directory:

git sed '{{find_text}}' '{{replace_text}}' -- {{path/to/directory}}