Chapter 3. Getting oriented with Git

 

The command line is where you’ll interact with Git. Yes, there are GUIs for Git (for example, Git GUI), and you’ll examine those, but most Git work is done by typing commands. Git was born on the command line, so it’s no surprise that all of its functionality is oriented toward commands that you have to type in. You’ll first learn about Git’s command-line syntax, a command-line pattern that will help you understand how all Git commands are structured. You’ll also orient yourself to the command line in general. If you’re a command-line veteran, chances are this chapter will be straightforward!

Finally, you’ll learn about the Git help system. Every command has help that you can access, and learning how to access it will enable you to become more effective with Git. Moreover, Git has longer-form documentation that is accessible from the help system. This documentation is worth reading, and this chapter shows you how to do that.

3.1. Getting set up

By now you should have already installed Git, which makes it immediately available to the command line. To open the command line on Mac or Linux, start your terminal program. In Windows, the CMD or PowerShell environments won’t suffice; you’ll have to start the Git BASH program, which should be a double-click away from either your desktop or your Windows Start menu, depending on how you installed it. From here on out, I’ll refer to this window as the command-line window (or command line for short).

3.2. Using commands

3.3. Improving command-line efficiency

3.4. Using Git help

3.5. Controlling long output with a pager

3.6. Lab

3.7. Further exploration

3.8. Commands in this chapter

sitemap