Files
mapas-mentales/mindmap/Appendix C_ Git Commands.md

3.0 KiB
Raw Permalink Blame History

# Appendix C: Git Commands
## Context / Why this appendix exists
- The book introduces “dozens” of Git commands
- Commands were introduced inside a narrative
  - Added “slowly” as the story progressed
- Result of narrative approach
  - Examples/usage of commands are “somewhat scattered” throughout the book
- Goal of this appendix
  - Go through **all Git commands addressed throughout the book**
  - Group them “roughly by what theyre used for”
  - For each command
    - Explain **very generally** what it does
    - Point out **where in the book** it was used

## Tip / Note: Abbreviating long options
- You can abbreviate long options (when unambiguous)
  - Example
    - `git commit --a` behaves like `git commit --amend`
- Constraint
  - Abbreviation works **only** when the letters after `--` are **unique** among options
- Guidance for scripting
  - Use the **full option** when writing scripts

## Setup and Config
- Two commands used “quite a lot”
  - From the **first invocations** of Git
  - Through **common every day** tweaking and referencing
- The two commands
  - `git config`
  - `git help`

### `git config`
- Core idea
  - Git has a **default way** of doing “hundreds of things”
  - `git config` lets you change those defaults and set preferences
- What configuration can include (examples given)
  - Your **name**
  - Your **email address**
  - Your **editor** preference
  - Specific **terminal color** preferences
  - (More generally) “hundreds of things” Git can be told to do differently
- How configuration is stored/applied
  - Multiple files are involved
    - The command can **read from** and **write to** several files
  - Scope flexibility
    - Set values **globally**
    - Or down to **specific repositories**

#### How often it appears in the book
- “Used in nearly every chapter of the book”

#### Where the book used `git config` (as listed)
- **First-Time Git Setup**
  - Used to specify
    - Name
    - Email address
    - Editor preference
  - Noted as happening “before we even got started using Git”
- **Git Aliases**
  - Used to create shorthand commands (aliases)
    - Aliases expand to long option sequences
    - Purpose: avoid typing long sequences every time
- **Rebasing**
  - Used to make `--rebase` the default behavior when running `git pull`
- **Credential Storage**
  - Used to set up a default store for HTTP passwords
- **Keyword Expansion**
  - Used to set up
    - “smudge” filters
    - “clean” filters
  - Purpose: manage content coming **into** and going **out of** Git
- **Git Configuration**
  - “Basically the entirety” of that section/chapter is dedicated to `git config`

### `git config core.editor` (editor configuration)
- Mentioned as a specific configuration focus
  - “git config core.editor commands”
- Linked context
  - Accompanies the configuration instructions in **Your Editor**
- What is stated
  - Many editors can be set using `core.editor`
- Boundary of provided material
  - The excerpt ends just before listing the specific editor command examples