Another great Video! Thanks so much Dan! BTW: I'd really love to see some videos about RegEx as you have a great and straight forward way of explaining things.
@ganainm014 жыл бұрын
Some grep history. grep comes from the ancient Unix line editor ed's "global" command, which applies another command to each line matching a regular expression ("re"). The "p" means "p"rint matching lines. This command could appear in manual pages as "g/re/p" - globally (i.e., cover all lines) search for the regular expression between the slashes and print matching lines. And because the namesake program does basically the same with files in the filesystem as the "g/re/p" command does with lines in a file, the program was simply called "grep."
@nefed-L11 ай бұрын
Как раз то, что я искала! Думаю, что за grep такой)) Thanks!
@BrendenVogt4 жыл бұрын
Great video!! Would love to see more tutorials in the future
@nbensa2 жыл бұрын
grep is g/re/p, an ed command to do g)lobal re)gular expression search and p)print 🙂 btw, ed is the precursor to v,i which in turn is the precursor to vim and, nowdays, nvim.
@yash1152 Жыл бұрын
and nowdays, helix
@aram56423 жыл бұрын
Never had a case for that grep, but recently in the git-log manual I came across what they call "pickaxe" which is searching among patches for an occurrence of a string, which is how you could search when a piece of code (like a function call) was added or even removed.
@yash1152 Жыл бұрын
> _"pickaxe" which is searching among patches for an occurrence of a string"_ > _"when a piece of code (like a function call) was added or even removed"_ i was also thinking about the ability to search within diffs/patches only
@jimkd31477 жыл бұрын
I noticed that your commit messages are in simple past. Mine were, too, until I recently switched to imperative because everyone else seems to do this and all the style guides tell you to do it. Can you make a video about commit message style?
@DanGitschooldude7 жыл бұрын
Interesting, I wasn't aware there was such guidance on tense of the commit messages. Good suggestion for a new video, I'll have to get smarter about the style conventions first. Thanks for watching!
@jimkd31477 жыл бұрын
You have to comply with the guidelines for commit messages the git developers like when contributing to git. Those seem to be pretty much the same rules you find when googling for commit message guidelines. I don't agree with all of them. That's why I think hearing the opinion of someone else who knows a lot about git would be interesting. Whether you write in simple past or imperative is a matter of taste, imho. But there are stupid rules like using at most 50 characters in the first line but leaving out the period in the end to save one character because staying below 50 characters can be difficult. I think leaving out the period in the end of a sentence is just pointless (no pun intended) when only trying to comply to an arbitrary limit which can just be increased by 1 to make up for the 1 character "wasted" for proper punctuation. Another imho stupid one it to do hard line breaking. I think doing proper visual line wrapping in the few cases the commit messages are printed isn't really difficult and it has two advantages: 1. You can view them in a terminal of arbitrary width. If the terminal you use is wider than the line wrapping length of hard line breaking, space is wasted. If it's smaller, it looks really, really awful. 2. If you edit a commit message after first writing it, undoing hard line breaking is wasted time. No need to do this with visual line wrapping. The git developers could just implement visual line wrapping, remove that rule, and be rid of the disadvantages of hard line breaking outlined above. I don't really see any disadvantages.
@yash1152 Жыл бұрын
9:12 how to make it show the line numbers too? so, like file.ext:12:chicken
@mbramante Жыл бұрын
can this be used in command window ?
@dhruvnaik35565 жыл бұрын
Global Search of Regular Expression(grep).
@rsmolkin6 жыл бұрын
Can you do git grep over multiple repos?
@DanGitschooldude6 жыл бұрын
Not sure what you mean. If you are asking if you can git grep over submodules, you can embed the command in a 'git submodule foreach 'git grep... ' ' to grep across any submodules as in the project. But no you can't git grep "outside" a particular repo because there's no history outside a repo!
@rsmolkin6 жыл бұрын
Dan Gitschooldude yeah I meant my company has over 100 repos and sometimes we need to search code across all of them
@DanGitschooldude6 жыл бұрын
Ah, I see. You'll probably want to write a script that traverses all your repos and executes the 'git grep' command in all of them. If your repos are all in a tool like Gitlab, you might be able to search across multiple projects, but I'm not sure if that's a feature in Gitlab or not. Thanks for watching!
@avijitsharma50505 жыл бұрын
Dan Gitschooldude I was also looking for the same thing as described by Roman in above comment.