1GIT-SED(1) Git Extras GIT-SED(1)
2
3
4
6 git-sed - replace patterns in git-controlled files
7
9 git-sed [ -c ] [ -f flags ] search replacement [ flags ]
10
12 Run git grep and then send results to sed for replacement with the
13 given flags, if they are provided via -f or as the third argument.
14
15 Also runs git commit if -c is provided.
16
18 -c
19
20 commit the resulting changes with a standard commit message detailing
21 the exact command ran. will fail if there are unstaged changes.
22
23 <flags> -f <flags>
24
25 will use the given regex flags in the sed command (for example "g"
26 replaces multiple times on the same line).
27
28 <search>
29
30 the pattern passed to grep and to the first part of the sed expression.
31
32 <replacement>
33
34 the replacement passed to sed, the second part of the sed expression.
35
37 $ git sed ´my_function´ ´do_stuff´
38 # ... only does the changes, without committing
39 $ git commit -m"use proper function name"
40 $ git sed -c ´do_stuff´ ´stuff´
41 # .. does the changes and a commit
42 $ git sed -f g do_stuff stuff
43 # .. g is actually pretty important, otherwise you will miss some
44 # stuff!
45
47 Written by Antoine Beaupré <anarcat@debian.org> from inspiration by
48 https://github.com/da-x/git-search-replace and http://stackover‐
49 flow.com/questions/9651898/is-there-a-git-sed-or-equivalent
50
52 <https://github.com/tj/git-extras/issues>
53
55 <https://github.com/tj/git-extras>
56
57
58
59 May 2018 GIT-SED(1)