background...
trying find commit(s) last touched specific file.
i can on cli piping git-log grep i'm trying wrap in zsh function, more ease of memory.
here's function, , here output i'd generate it.
# match lines git log start commit or include # filename i'm interested in , pipe through grep color output glpg() { \git log --name-only | \grep -e ‘“$"|^commit\s\s' | \grep -b1 --color -e ‘$' } desired usage , output
dwight:assets (add-analytics*) $ glpg clickouts commit 6662418b8e68e478b95e7254faa6406abdada30f web/assets/app/viewmodels/clickouts.js web/assets/app/views/clickouts.html web/client/app/viewmodels/clickouts.js web/client/app/views/clickouts.html -- commit cee37549f613985210c9caf90a48e2cca28d4412 web/client/app/viewmodels/clickouts.js web/client/app/views/clickouts.html -- commit df9ea8cd90ff80b89a0c7e2b0657141b105d5e7e web/client/app/viewmodels/clickouts.js web/client/app/views/clickouts.html
three problems.
- you use unicode apostrophes , quotes, ‘ , “. replace them ascii quotes , doublequotes.
- you can't use \s , \s mean space or non-space standard (posix) grep. use
' ',[^ ]instead portable. - the list of args referenced
"$@"including double quotes.
Comments
Post a Comment