Jessica Wang
June 21, 2022
4 min

Replacing Your Git Command Cheat Sheet With AI Command Search

Cheat sheets are great, but I think we can do better. What happens when you forget to bookmark your cheat sheet, or constantly context switch out of your terminal just to find the one command you need out of a huge list of commands? It takes quite a while and slows down your development process a lot.

I'm going to suggest an alternative approach. Warp's AI Command search is a feature our team just launched that takes natural language and converts it into commands for you - in the matter of seconds. You no longer have to leave the terminal or search through pages of commands to find the one you're looking for.

However, my biggest fear when using this feature revolves around one the big question - how reliable is this AI Command Search? Can I trust that the commands it gives me are going to be correct?

It's a good question, and today I wanted to put it to the test! In this blog, I'm going to be giving Warp's AI Command Search a pop quiz. I have a git cheat sheet with 24 commands...

Git Cheat Sheet

... and I am going to be inputting the natural language description of these commands into the AI Command Search, and seeing what command it generates for me. We will be keeping score, so Warp will be getting +1 point for each command it correctly generates, for a total grand score of 24 points for the 24 commands on the cheat sheet. Let's get started!

1) Initialize a New Git Repository

Expected Command:

git init

AI Command Search Output:

git init

Score:

1/24

This is a perfect match between the outputted command and the git cheat sheet, so I'm giving Warp's AI Command Search +1 points. 

I'd also like to note that though this video is sped up x2, I didn't cut any part of the screen capture - meaning that these commands are being generated in less than a few seconds.


2) Set Configuration Values for Your Username and Email

Expected Command:

git config --global user.name <your-name>
git config --global user.email <your-email>

AI Command Search Output:

git config --global user.name "Your Name"
git config --global user.email "

Score:

1.9/24

I gave the AI Command Search .9 points here. The "Your Email" was cut-off when I inputted it into the command line, and I would want arrow brackets around the parameters to indicate that they are parameters.

3) Clone a Repository

Expected Command:

git clone <repository-url>

AI Command Search Output:

git clone

Score:

2.8/24

I gave the AI Command Search .9 points here. It got the main command correct, which I think is the important part, but did miss any indicator that the user would need to input the url of the repository that they want to clone after "git clone". I could see this causing some confusion for somebody using this command for the first time.

4) Add a File to the Staging Area

Expected Command:

git add <file>

AI Command Search Output:

git add file.txt

Score:

3.7/24


I gave the AI Command Search .9 points here. Though I think most people would be able to deduce that "file.txt" is a call for them to input the name of their actual file, I would have preferred that the command be encased by quotes or arrow brackets of some sort to indicate easily that this is a parameter that requires manual input, similar to how the git cheat sheet writes it.

5) Add All Files Changes to the Staging Area

Expected Command:

git add .

AI Command Search Output:

git add .

Score:

4.7/24


No comments - this was a perfect match and +1 full point!

6) Check the Unstaged Changes

Expected Command:

git diff

AI Command Search Output:

git diff

Score:

5.7/24


No comments - this was a perfect match and +1 full point!

7) Commit the Staged Changes

Expected Command:

git commit -m "Message"

AI Command Search Output:

git commit -m "message"

Score:

6.7/24


No comments - this was a perfect match and +1 full point!

8) Reset the Staging Area to the Last Commit

Expected Command:

git reset

AI Command Search Output:

git reset HEAD

Score:

7.7/24

I'm giving AI Command Search +1 full point on this one. The official command for this description would be "git reset <tree/commit/file>", but if you do not specify this parameter, it will default to HEAD - which is the command that Warp generated.

9) Check the State of the Working Directory and the Staging Area

Expected Command:

git status

AI Command Search Output:

git status

Score:

8.7/24


No comments - this was a perfect match and +1 full point!

10) Remove a File from the Index and Working Directory

Expected Command:

git rm <file>

AI Command Search Output:

git rm file.txt

Score:

9.6/24


I gave the AI Command Search .9 points here. Though I think most people would be able to deduct that "file.txt" is a call for them to input the name of their actual file, I would have preferred that the command be encased by quotes or arrow brackets of some sort to indicate easily that this is a parameter that requires manual input, similar to how the git cheat sheet writes it.

11) List the Commit History

Expected Command:

git log

AI Command Search Output:

git log

Score:

10.6/24


No comments - this was a perfect match and +1 full point!

12) Check the Metadata and the Content Changes of the Commit

Expected Command:

git show <commit-hash>

AI Command Search Output:

git diff

Score:

11.3/24

  • "git show <commit-hash>" is used to see the difference between the commit in question and it's predecessor.
  • "git diff" is used to diff any two commits.

I am giving the AI Command Search .7 points here. I'm fine with the command "git diff" even though it is different than "git show" because they achieve the same thing - you can check metadata and content changes of a commit with "git diff" as well. I'm taking off points because "git diff" run in the CLI by itself doesn't output anything. The user needs to put the two commits they want to compare as parameters in order to get useful information, and AI Command Search doesn't hint to that at all in the generated command.

13) Lists All Local Branches

Expected Command:

git branch

AI Command Search Output:

git branch

Score:

12.3/24


No comments - this was a perfect match and +1 full point!

14) Create a New Branch

Expected Command:

git branch <branch-name>

AI Command Search Output:

git branch <branch name>

Score:

13.3/24


No comments - this was a perfect match and +1 full point!

15) Rename the Current Branch

Expected Command:

git branch -m <new-branch-name>

AI Command Search Output:

git branch -m new-branch-name

Score:

14.2/24

I gave the AI Command Search .9 points here. Though I think most people would be able to deduce that "new-branch-name" is a call for them to input the name of their actual file, I would have preferred that the command be encased by quotes or arrow brackets of some sort to indicate easily that this is a parameter that requires manual input, similar to how the git cheat sheet writes it.

16) Delete a Branch

Expected Command:

git branch -d <branch-name>

AI Command Search Output:

git branch -d <branch name>

Score:

15.2/24


No comments - this was a perfect match and +1 full point!

17) Switch to Another Branch

Expected Command:

git checkout <branch-name>

AI Command Search Output:

git checkout branch_name

Score:

16.1/24


I gave the AI Command Search .9 points here. Though I think most people would be able to deduce that "branch_name" is a call for them to input the name of their actual file, I would have preferred that the command be encased by quotes or arrow brackets of some sort to indicate easily that this is a parameter that requires manual input, similar to how the git cheat sheet writes it.

18) Merge Specified Branch into Current Branch

Expected Command:

git merge <branch-name>

AI Command Search Output:

git merge <branch name>

Score:

17.1/24


No comments - this was a perfect match and +1 full point!

19) Create a New Connection to a Remote Repo

Expected Command:

git remote add <name> <repository-url>

AI Command Search Output:

git remote add origin https://github.com/username/repository.git

Score:

17.9/24


I'm giving AI Command Search .8 points here, mostly because it's not clear that "origin" and "https://github.com/username/repository.git" are parameters to the "git remote" command. The git command cheat sheet makes that very clear by encasing these by arrow brackets.

20) Push the Committed Changes to a Remote Repo

Expected Command:

git push <remote> <branch>

AI Command Search Output:

git push

Score:

18.6/24


I'm giving AI Command Search .7 points here because it got the main part of the command, but missed some important parameters. If you run git push before setting an upstream branch, you may get an error like this:

Git push error

This can definitely be confusing to a developer who might be new to this command and has no idea what to input.

21) Download the Content From a Remote Repo

Originally, I typed in "download the content from remote repo" and got "git clone". Honestly, it makes sense why the AI Command Search outputted this command, but this command did not match the git cheat sheet. I decided to experiment a little here and changed "download" to "sync", because I thought that was little more accurate. This is what I got:

Expected Command:

git pull <remote>

AI Command Search Output:

git pull

Score:

19.2/24


I'm giving the AI Command Search .6 points here. It required a little tweaking with the natural language to get the correct command, which I could do only because I'm familiar with these git commands. On top of that, I'm deducting points because the AI Command Search didn't include the necessary parameters - running just "git pull" without a specifying which branch to merge with may output an error in your terminal.

Git pull warning

22) Cleanup Unnecessary Files and Optimize the Local Repo

Expected Command:

git gc

AI Command Search Output:

git gc

Score:

20.2/24


No comments - this was a perfect match and +1 full point!

23) Temporarily Remove Uncommitted Changes and Save Them for Later Use

Expected Command:

git stash

AI Command Search Output:

git stash

Score:

21.2/24

No comments - this was a perfect match and +1 full point!

24) Reapply Previously Stashed Changes

Expected Command:

git stash apply

AI Command Search Output:

git stash pop

Score:

22.1/24


I am giving the AI Command Search .9 points for this one - "git stash pop" and "git stash apply" are very similar. "Git stash pop" throws away the topmost (by default) stash when applying it, whereas "git stash apply" leaves it within the stash list for possible later use. I am deducting .1 points because git stash apply is a little safer to use, but not being too harsh here because there's nothing in the natural language description that really indicated this one way or the other. Both commands do the job.

Conclusion

Overall, I thought Warp's AI Command Search performed very well in this pop quiz. The final score was 22.1/24, which works out to 92%!

13 of the commands were perfect matches to what the Git Command cheat sheet provided.

Of the other commands that were docked points, most of those were because they didn't clearly specify the parameter with arrow brackets, or the natural language description itself was vague. I can see it these lack of details being potentially confusing for people who are very new to coding and have never used git before. However, if you're a software engineer with some coding background, have a general understanding of git, or just need a quick refresher on some commands that slipped your memory, I think that AI Command Search's generated commands should be pretty self-explanatory.

After running all these commands, I have a lot of confidence in the reliability and accuracy of Warp's AI Command Search. I'd rather use it as a jumping off point than consulting Google searches or a static cheat sheet. It's quicker, more direct, and has a lot more options.

Want to try out AI Command Search Yourself?

If you're interested in trying out AI Command Search yourself, you can!

Download Warp using the Download button in the top right corner of this site. It's free to use. If you want to hear from the people who are already using Warp, go here.

Once you have Warp downloaded, you can check out our official documentation, or simply press CTRL + ` to open up the AI Command Search panel.

And if you try out any interesting commands, we'd always love for you to tweet them and mention us @warpdotdev on Twitter, or share them on our Discord. You can find all our social media links below.

Thanks for reading!

Share

View More