Skip to contentSkip to conversation

Added a git search and replace command

PATCH New Sverre Rabbelier 1 participant 1 message Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Added a git search and replace command

A simple script that uses 'git ls-files' and xargs to search and replace all the specified files.
---

Not meant for inclusion, just a simple script I wrote up when I wanted to change a function name in my repository but didn't want to figure out which magic argument to find does what I want. Another advantage of using git ls-files is that it will prevent that any unrevertable changes will be made (since the script checks if the tree is dirty or not). I'm sure there's plenty of room for improvement here, it's probably not portable at all either, so comments are welcome :).

 .gitignore |    1 +
 Makefile   |    1 +
 git-sar.sh |   61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 63 insertions(+), 0 deletions(-)
 create mode 100755 git-sar.sh
.gitignore +1 -0
index a213e8e..451cb93 100644
@@ -108,6 +108,7 @@ git-rev-list
 git-rev-parse
 git-revert
 git-rm
+git-sar
 git-send-email
 git-send-pack
 git-sh-setup
Makefile +1 -0
index b01cf1c..979e9ea 100644
@@ -252,6 +252,7 @@ SCRIPT_SH += git-sh-setup.sh
 SCRIPT_SH += git-stash.sh
 SCRIPT_SH += git-submodule.sh
 SCRIPT_SH += git-web--browse.sh
+SCRIPT_SH += git-sar.sh
 
 SCRIPT_PERL += git-add--interactive.perl
 SCRIPT_PERL += git-archimport.perl
git-sar.sh new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
1.5.6.4.570.g052e.dirty