1GIT-SED(1)                        Git Extras                        GIT-SED(1)
2
3
4

NAME

6       git-sed - replace patterns in git-controlled files
7

SYNOPSIS

9       git-sed  [ -c ] [ -f flags ] search replacement [ flags ] [ -- pathspec
10       ]
11

DESCRIPTION

13       Run git grep and then send results to  sed  for  replacement  with  the
14       given flags, if they are provided via -f or as the third argument.
15
16       Also runs git commit if -c is provided.
17

OPTIONS

19       -c
20
21       commit  the  resulting changes with a standard commit message detailing
22       the exact command ran. It will fail if there are unstaged changes.
23
24       <flags> -f <flags>
25
26       will use the given regex flags in the  sed  command  (for  example  "g"
27       replaces multiple times on the same line).
28
29       <search>
30
31       the pattern passed to grep and to the first part of the sed expression.
32
33       <replacement>
34
35       the replacement passed to sed, the second part of the sed expression.
36
37       -- <pathspec>
38
39       limit     the    paths    which    will    be    applied    on.    Read
40       https://git-scm.com/docs/gitglossary.html#Documentation/gitglos‐
41       sary.txt-aiddefpathspecapathspec  for  the  supported patterns of path‐
42       spec.
43

EXAMPLES

45       $ git sed ´my_function´ ´do_stuff´
46       # ... only does the changes, without committing
47       $ git commit -m"use proper function name"
48       $ git sed -c ´do_stuff´ ´stuff´
49       # .. does the changes and a commit
50       $ git sed -f g do_stuff stuff
51       # .. g is actually pretty important, otherwise you will miss some
52       # stuff!
53       $ git sed ´my_method´ ´do_stuff´ -- lake/
54       # ... only replace ´my_method´ occurs under lake/.
55

AUTHOR

57       Written by Antoine Beaupré  <anarcat@debian.org>  from  inspiration  by
58       https://github.com/da-x/git-search-replace    and    https://stackover
59       flow.com/questions/9651898/is-there-a-git-sed-or-equivalent
60

REPORTING BUGS

62       <https://github.com/tj/git-extras/issues>
63

SEE ALSO

65       <https://github.com/tj/git-extras>
66
67
68
69                                 January 2020                       GIT-SED(1)
Impressum