Help me, Git!
This is another part of what will be a multi-part series on the very basics of Git. I’m not a Git master, but I do know a thing or two. My goal with all of these is to provide a humorous tutorial where you will learn at least one thing of value about a very specific aspect of Git. There are valuable manuals, mentioned below, that can give you the “meat-and-potatoes” rundown of Git. I’m just here for the appetizers.
This time I’m tackling the Git command “git help” and some nifty things that happen when you use this command.
When you type “git help” into your command line, Git will list out a variety of commands you can utilize the powers of Git with. Let’s take a look at what comes up.
What’s awesome about this is we get a list not only of the commands, but we also get a basic description of what the commands do. Well, what if you haven’t read through other tutorials of mine and don’t really know about one of these commands?
Git has a solution to this. Just type “git help (insert command in question)”, and you get a more detailed description along with the documentation for that command. Check it out!
git help commit
I didn’t want to use the entire documentation in the screenshot. In fact, in this case, I wouldn’t have been able to. The documentation is pretty extensive on this specific command giving you all instances of flag sub-commands you can attach to “git help commit”. As you can see at the bottom of the screenshot, it’s starting another category, which is where I decided to end the screenshot. At the bottom of the screenshot, though, it’s saying that if you find a mistake immediately after making the commit, just use “git reset” — the subject of an upcoming article of mine — to recover from it. This “git help” documentation is also giving you basic command chains for different predicaments you might encounter.
There are really only 3 good books on Git to my knowledge — Git for Humans, Pro Git, and Git in Practice — so being able to utilize Git’s own documentation like this with a Git command created specifically for this purpose. Well… that’s pretty damn helpful. You could of course bring 3 books on Git to your workplace and rummage through them to find out whether you’re making the correct choice for a command for what you need to do… OR… you could Google for who knows how long siphoning through opinion articles and Stack Overflow… OR… you could just type “git help (insert command in question)” and receive Git’s own documentation about it. I, personally, would opt for the last one.
Git has your best interests in mind if, and only if, you understand how to ask Git for what you need. In this case, just scream, “Help me, Git!”. Actually… don’t do that. Just type “git help (insert command in question)”, and you shall be served a smorgasbord.
Have fun… but don’t be scared to ask for help — git help, that is.