Command Line Git
Command Line Git
Everything you need to know to get started
About the Book
This book explains how to use Git from command line on Windows, Mac OS and Linux
Small startups and big companies use Git in their workflows:
- to deploy projects
- to collaborate
- to find and fix bugs
- to backup code
There is simply no way around it if you are a Software Developer.
The problem is it can be very confusing.
- Git has many commands each with its own set of options.Commands can behave differently depending on their options.
- The command line interface has no visual guidance.You have to use your imagination to understand what is going on.
- The concepts used by Git: diff, staging, commits, branches, remotes, etc.It is not always clear what they mean and how they work.
If you get stuck with Git and search for help – you’ll find two kinds of resources:
- Specific recipes that you have to follow blindly
- Reference manuals full of complex terminology and technical details
This book is different
It is a guide that will help you understand how Git works.
It is designed to give you the necessary knowledge to get started without overwhelming you with too much information.
Key Features
- Mental Models – analogies and visualizations to help you understand how Git works.
- Illustrations – the book has illustrations that will help you understand the concepts better and make them more memorable.
- Exercises – each chapter has exercises that will help you understand and remember the concepts better. They will also help you develop the muscle memory for the commands.
- Example Repositories – most exercises have example repositories that you can use to experiment with Git. This will be very useful even after you finish the book. You will be able to use them as testing grounds if you got stuck with a problem in your project.
How This Book Helps
First it goes over a typical workflow explaining what happens at each step.
Then it goes over the most important commands and concepts.
To help you understand and remember the concepts, the book uses analogies and visualizations.
In the end of each chapter there are exercises that use example repositories.
These exercises will help you understand and remember the concepts better.
The example repositories that come with the exercises also serve as laboratories where you can experiment with Git.
This will be very useful even after you finish the book. You will be able to use them as testing grounds if you got stuck with a problem in your project.
Packages
The Book
Includes:
Exercises
Example repositories to practice the techniques described in the book.
PDF
EPUB
WEB
English
One for a friend too
+1 copy (for a friend)
Includes:
Exercises
Example repositories to practice the techniques described in the book.
PDF
EPUB
WEB
English
Team Package
Buy 10 copies at once.
Includes:
Exercises
Example repositories to practice the techniques described in the book.
PDF
EPUB
WEB
English
Table of Contents
- Introduction
- Why Learn Git?
- Why Use the Command Line?
- Prerequisites
- What You’ll Learn
- How to Use This Book
- How to Download the Exercises
- How to Get Help
- How Git Works - Building a Mental Model
- What is Version Control?
- What is Distributed Version Control?
- How Does Git Work?
- Git Workflow
- Installing and Using Git on Windows
- Installing Git Using the Official Installer
- PowerShell Primer
- Installing Git on Mac OS
- Installing Git on Linux
- Installing Git
- Mac OS and Linux Command Line Primer
- How to Open the Command Line
- How to Use the Command Line
- Configuring Git
- Configuration Levels
- Configuring Git Using Text Files
- Complete List of Available Settings
- Using the Config Command
- Setting Configuration Options
- Removing Configuration Settings
- Viewing Configuration Settings
- Exercises
- Creating a Repository
- Before You Start
- How to Clone a Repository
- How to Initialize a Repository in an Existing Folder
- What is Inside the .git Folder
- Exercises
- Checking the Status of a Repository
- How to Use the Status Command
- Short Status
- Exercises
- Selecting Changes to Commit - Staging
- How to Stage Changes
- Staging Multiple Files
- Viewing Staged Changes
- Removing Files From the Staging Area
- Staging Individual Changes
- Exercises
- Committing Changes
- Merge Commits
- How to Commit Changes
- How to Overwrite the Last Commit
- Exercises
- Understanding .gitignore
- How to Ignore Files
- Glob Patterns
- Generate a .gitignore File for Your Project
- Exercises
- Viewing the Commit History
- How to View the Commit History
- How to View the Commit History in One Line
- How to View the Commit History in a Graph
- Exercises
- Switching Between Commits
- What Does It Mean to Switch Between Commits?
- How to Switch to a Particular Commit
- How to Switch Relative to the Current Commit
- How to Switch Back
- Exercises
- Understanding HEAD
- When the HEAD is Detached
- What Happens When You Commit in the Detached HEAD State
- How to Find Dangling Commits
- How to Reattach the Dangling Commit
- How to Fix the Detached HEAD
- Exercises
- Restoring the Working Directory
- Discarding the Untracked Files
- Discarding the Tracked Files
- Discarding the Staged Files
- Exercises
- Undoing Changes
- Reverting the Commit
- Resetting Changes
- Exercises
- Using branches
- How Does Git Store Branches
- Creating New Branches
- Switching Branches
- Listing Branches
- Deleting Branches
- Merging Branches
- Exercises
- Resolving Merge Conflicts
- How Conflicts Happen
- How to Avoid Conflicts
- How to Resolve Conflicts
- Exercises
- Stashing changes
- What is a Stash?
- Put Aside Changes
- View Stashes
- Using Named Stashes
- Preview Stash Contents
- Apply Stashes
- Drop stash
- Exercises
- Using Remotes
- What is a Remote
- Adding a Remote
- Adding GitHub as a Remote Repository
- Listing Remotes
- Pushing to a Remote Repository
- Pulling or Fetching from a Remote Repository
- Renaming Remotes
- Removing Remotes
- Exercises
- Afterword
- Appendix
- Answers to Exercises
- Introduction
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them