Lab 2

Hello everyone,

So I have been using Git for about 3 weeks now, and frankly, I still feel like I got a lot to learn in order to fully use Git’s potential. This week’s lab is to find some new Git’s command to work on, and I found out some interesting commands to learn and apply. This blog will introduce how to use git-grep and git-show.


git-grep is used to print lines matching a pattern and easily search through anything. It will try to look through the files in the current working directory.


Search working tree for text matching regular expression regexp:

git grep <regexp>

Search working tree for lines of text matching regular expression regexp1 or regexp2:

git grep -e <regexp1> [--or] -e <regexp2>


+git-grep doc link:

+git-grep references:


It is used mainly to shows one or more objects (blobs, trees, tags and commits). This command can be useful when you want to search for some elements


Shows the tree pointed to by the tag v2.0.0

git show v2.0.0^{tree}

Shows the contents of the file Documentation/README as they were current in the 10th last commit of the branch next

git show next~10:Documentation/README


+git-grep doc link:

+git-grep references:

Overall, these commands can prove useful to me in the future for me. In the mean time, I will try to use these commands more to understand them properly. Thank you for reading.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s