The Notes for Professionals book is compiled from Stack Overflow Documentation, the content is written by the beautiful people at Stack Overflow. Text content is released under Creative Commons BY-SA. See credits at the end of this book whom contributed to the various chapters. Images may be copyright of their respective owners unless otherwise specified
Book created for educational purposes and is not affiliated with group(s), company(s) nor Stack Overflow. All trademarks belong to their respective company owners
https://goalkicker.com/
章節目錄
1-1
Content list
1-2
About
1-3
Chapter 1: Getting started with Git
1-4
Section 1.1: Create your first repository, then add and commit files
1-5
Section 1.2: Clone a repository
1-6
Section 1.3: Sharing code
1-7
Section 1.4: Setting your user name and email
1-8
Section 1.5: Setting up the upstream remote
1-9
Section 1.6: Learning about a command
1-10
Section 1.7: Set up SSH for Git
1-11
Section 1.8: Git Installation
1-12
Chapter 2: Browsing the history
1-13
Section 2.1: "Regular" Git Log
1-14
Section 2.2: Prettier log
1-15
Section 2.3: Colorize Logs
1-16
Section 2.4: Oneline log
1-17
Section 2.5: Log search
1-18
Section 2.6: List all contributions grouped by author name
1-19
Section 2.7: Searching commit string in git log
1-20
Section 2.8: Log for a range of lines within a file
1-21
Section 2.9: Filter logs
1-22
Section 2.10: Log with changes inline
1-23
Section 2.11: Log showing commited files
1-24
Section 2.12: Show the contents of a single commit
1-25
Section 2.13: Git Log Between Two Branches
1-26
Section 2.14: One line showing commiter name and time since commit
1-27
Chapter 3: Working with Remotes
1-28
Section 3.1: Deleting a Remote Branch
1-29
Section 3.2: Changing Git Remote URL
1-30
Section 3.3: List Existing Remotes
1-31
Section 3.4: Removing Local Copies of Deleted Remote Branches
1-32
Section 3.5: Updating from Upstream Repository
1-33
Section 3.6: ls-remote
1-34
Section 3.7: Adding a New Remote Repository
1-35
Section 3.8: Set Upstream on a New Branch
1-36
Section 3.9: Getting Started
1-37
Section 3.10: Renaming a Remote
1-38
Section 3.11: Show information about a Specific Remote
1-39
Section 3.12: Set the URL for a Specific Remote
1-40
Section 3.13: Get the URL for a Specific Remote
1-41
Section 3.14: Changing a Remote Repository
1-42
Chapter 4: Staging
1-43
Section 4.1: Staging All Changes to Files
1-44
Section 4.2: Unstage a file that contains changes
1-45
Section 4.3: Add changes by hunk
1-46
Section 4.4: Interactive add
1-47
Section 4.5: Show Staged Changes
1-48
Section 4.6: Staging A Single File
1-49
Section 4.7: Stage deleted files
1-50
Chapter 5: Ignoring Files and Folders
1-51
Section 5.1: Ignoring files and directories with a .gitignore file
1-52
Section 5.2: Checking if a file is ignored
1-53
Section 5.3: Exceptions in a .gitignore file
1-54
Section 5.4: A global .gitignore file
1-55
Section 5.5: Ignore files that have already been committed to a Git repository
1-56
Section 5.6: Ignore files locally without committing ignore rules
1-57
Section 5.7: Ignoring subsequent changes to a file (without removing it)
1-58
Section 5.8: Ignoring a file in any directory
1-59
Section 5.9: Prefilled .gitignore Templates
1-60
Section 5.10: Ignoring files in subfolders (Multiple gitignore files)
1-61
Section 5.11: Create an Empty Folder
1-62
Section 5.12: Finding files ignored by .gitignore
1-63
Section 5.13: Ignoring only part of a file [stub]
1-64
Section 5.14: Ignoring changes in tracked files. [stub]
1-65
Section 5.15: Clear already committed files, but included in .gitignore
1-66
Chapter 6: Git Di
1-67
Section 6.1: Show dierences in working branch
1-68
Section 6.2: Show changes between two commits
1-69
Section 6.3: Show dierences for staged files
1-70
Section 6.4: Comparing branches
1-71
Section 6.5: Show both staged and unstaged changes
1-72
Section 6.6: Show dierences for a specific file or directory
1-73
Section 6.7: Viewing a word-di for long lines
1-74
Section 6.8: Show dierences between current version and last version
1-75
Section 6.9: Produce a patch-compatible di
1-76
Section 6.10: dierence between two commit or branch
1-77
Section 6.11: Using meld to see all modifications in the working directory
1-78
Section 6.12: Di UTF-16 encoded text and binary plist files
1-79
Chapter 7: Undoing
1-80
Section 7.1: Return to a previous commit
1-81
Section 7.2: Undoing changes
1-82
Section 7.3: Using reflog
1-83
Section 7.4: Undoing merges
1-84
Section 7.5: Revert some existing commits
1-85
Section 7.6: Undo / Redo a series of commits
1-86
Chapter 8: Merging
1-87
Section 8.1: Automatic Merging
1-88
Section 8.2: Finding all branches with no merged changes
1-89
Section 8.3: Aborting a merge
1-90
Section 8.4: Merge with a commit
1-91
Section 8.5: Keep changes from only one side of a merge
1-92
Section 8.6: Merge one branch into another
1-93
Chapter 9: Submodules
1-94
Section 9.1: Cloning a Git repository having submodules
1-95
Section 9.2: Updating a Submodule
1-96
Section 9.3: Adding a submodule
1-97
Section 9.4: Setting a submodule to follow a branch
1-98
Section 9.5: Moving a submodule
1-99
Section 9.6: Removing a submodule
1-100
Chapter 10: Committing
1-101
Section 10.1: Stage and commit changes
1-102
Section 10.2: Good commit messages
1-103
Section 10.3: Amending a commit
1-104
Section 10.4: Committing without opening an editor
1-105
Section 10.5: Committing changes directly
1-106
Section 10.6: Selecting which lines should be staged for committing
1-107
Section 10.7: Creating an empty commit
1-108
Section 10.8: Committing on behalf of someone else
1-109
Section 10.9: GPG signing commits
1-110
Section 10.10: Commiting changes in specific files
1-111
Section 10.11: Committing at a specific date
1-112
Section 10.12: Amending the time of a commit
1-113
Section 10.13: Amending the author of a commit
1-114
Chapter 11: Aliases
1-115
Section 11.1: Simple aliases
1-116
Section 11.2: List / search existing aliases
1-117
Section 11.3: Advanced Aliases
1-118
Section 11.4: Temporarily ignore tracked files
1-119
Section 11.5: Show pretty log with branch graph
1-120
Section 11.6: See which files are being ignored by your .gitignore configuration
1-121
Section 11.7: Updating code while keeping a linear history
1-122
Section 11.8: Unstage staged files
1-123
Chapter 12: Rebasing
1-124
Section 12.1: Local Branch Rebasing
1-125
Section 12.2: Rebase: ours and theirs, local and remote
1-126
Section 12.3: Interactive Rebase
1-127
Section 12.4: Rebase down to the initial commit
1-128
Section 12.5: Configuring autostash
1-129
Section 12.6: Testing all commits during rebase
1-130
Section 12.7: Rebasing before a code review
1-131
Section 12.8: Aborting an Interactive Rebase
1-132
Section 12.9: Setup git-pull for automatically perform a rebase instead of a merge
1-133
Section 12.10: Pushing after a rebase
1-134
Chapter 13: Configuration
1-135
Section 13.1: Setting which editor to use
1-136
Section 13.2: Auto correct typos
1-137
Section 13.3: List and edit the current configuration
1-138
Section 13.4: Username and email address
1-139
Section 13.5: Multiple usernames and email address
1-140
Section 13.6: Multiple git configurations
1-141
Section 13.7: Configuring line endings
1-142
Section 13.8: configuration for one command only
1-143
Section 13.9: Setup a proxy
1-144
Chapter 14: Branching
1-145
Section 14.1: Creating and checking out new branches
1-146
Section 14.2: Listing branches
1-147
Section 14.3: Delete a remote branch
1-148
Section 14.4: Quick switch to the previous branch
1-149
Section 14.5: Check out a new branch tracking a remote branch
1-150
Section 14.6: Delete a branch locally
1-151
Section 14.7: Create an orphan branch (i.e. branch with no parent commit)
1-152
Section 14.8: Rename a branch
1-153
Section 14.9: Searching in branches
1-154
Section 14.10: Push branch to remote
1-155
Section 14.11: Move current branch HEAD to an arbitrary commit
1-156
Chapter 15: Rev-List
1-157
Section 15.1: List Commits in master but not in origin/master
1-158
Chapter 16: Squashing
1-159
Section 16.1: Squash Recent Commits Without Rebasing
1-160
Section 16.2: Squashing Commit During Merge
1-161
Section 16.3: Squashing Commits During a Rebase
1-162
Section 16.4: Autosquashing and fixups
1-163
Section 16.5: Autosquash: Committing code you want to squash during a rebase
1-164
Chapter 17: Cherry Picking
1-165
Section 17.1: Copying a commit from one branch to another
1-166
Section 17.2: Copying a range of commits from one branch to another
1-167
Section 17.3: Checking if a cherry-pick is required
1-168
Section 17.4: Find commits yet to be applied to upstream
1-169
Chapter 18: Recovering
1-170
Section 18.1: Recovering from a reset
1-171
Section 18.2: Recover from git stash
1-172
Section 18.3: Recovering from a lost commit
1-173
Section 18.4: Restore a deleted file after a commit
1-174
Section 18.5: Restore file to a previous version
1-175
Section 18.6: Recover a deleted branch
1-176
Chapter 19: Git Clean
1-177
Section 19.1: Clean Interactively
1-178
Section 19.2: Forcefully remove untracked files
1-179
Section 19.3: Clean Ignored Files
1-180
Section 19.4: Clean All Untracked Directories
1-181
Chapter 20: Using a .gitattributes file
1-182
Section 20.1: Automatic Line Ending Normalization
1-183
Section 20.2: Identify Binary Files
1-184
Section 20.3: Prefilled .gitattribute Templates
1-185
Section 20.4: Disable Line Ending Normalization
1-186
Chapter 21: .mailmap file: Associating contributor and email aliases
1-187
Section 21.1: Merge contributers by aliases to show commit count in shortlog
1-188
Chapter 22: Analyzing types of workflows
1-189
Section 22.1: Centralized Workflow
1-190
Section 22.2: Gitflow Workflow
1-191
Section 22.3: Feature Branch Workflow
1-192
Section 22.4: GitHub Flow
1-193
Section 22.5: Forking Workflow
1-194
Chapter 23: Pulling
1-195
Section 23.1: Pulling changes to a local repository
1-196
Section 23.2: Updating with local changes
1-197
Section 23.3: Pull, overwrite local
1-198
Section 23.4: Pull code from remote
1-199
Section 23.5: Keeping linear history when pulling
1-200
Section 23.6: Pull, "permission denied"
1-201
Chapter 24: Hooks
1-202
Section 24.1: Pre-push
1-203
Section 24.2: Verify Maven build (or other build system) before committing
1-204
Section 24.3: Automatically forward certain pushes to other repositories
1-205
Section 24.4: Commit-msg
1-206
Section 24.5: Local hooks
1-207
Section 24.6: Post-checkout
1-208
Section 24.7: Post-commit
1-209
Section 24.8: Post-receive
1-210
Section 24.9: Pre-commit
1-211
Section 24.10: Prepare-commit-msg
1-212
Section 24.11: Pre-rebase
1-213
Section 24.12: Pre-receive
1-214
Section 24.13: Update
1-215
Chapter 25: Cloning Repositories
1-216
Section 25.1: Shallow Clone
1-217
Section 25.2: Regular Clone
1-218
Section 25.3: Clone a specific branch
1-219
Section 25.4: Clone recursively
1-220
Section 25.5: Clone using a proxy
1-221
Chapter 26: Stashing
1-222
Section 26.1: What is Stashing?
1-223
Section 26.2: Create stash
1-224
Section 26.3: Apply and remove stash
1-225
Section 26.4: Apply stash without removing it
1-226
Section 26.5: Show stash
1-227
Section 26.6: Partial stash
1-228
Section 26.7: List saved stashes
1-229
Section 26.8: Move your work in progress to another branch
1-230
Section 26.9: Remove stash
1-231
Section 26.10: Apply part of a stash with checkout
1-232
Section 26.11: Recovering earlier changes from stash
1-233
Section 26.12: Interactive Stashing
1-234
Section 26.13: Recover a dropped stash
1-235
Chapter 27: Subtrees
1-236
Section 27.1: Create, Pull, and Backport Subtree
1-237
Chapter 28: Renaming
1-238
Section 28.1: Rename Folders
1-239
Section 28.2: rename a local and the remote branch
1-240
Section 28.3: Renaming a local branch
1-241
Chapter 29: Pushing
1-242
Section 29.1: Push a specific object to a remote branch
1-243
Section 29.2: Push
1-244
Section 29.3: Force Pushing
1-245
Section 29.4: Push tags
1-246
Section 29.5: Changing the default push behavior
1-247
Chapter 30: Internals
1-248
Section 30.1: Repo
1-249
Section 30.2: Objects
1-250
Section 30.3: HEAD ref
1-251
Section 30.4: Refs
1-252
Section 30.5: Commit Object
1-253
Section 30.6: Tree Object
1-254
Section 30.7: Blob Object
1-255
Section 30.8: Creating new Commits
1-256
Section 30.9: Moving HEAD
1-257
Section 30.10: Moving refs around
1-258
Section 30.11: Creating new Refs
1-259
Chapter 31: git-tfs
1-260
Section 31.1: git-tfs clone
1-261
Section 31.2: git-tfs clone from bare git repository
1-262
Section 31.3: git-tfs install via Chocolatey
1-263
Section 31.4: git-tfs Check In
1-264
Section 31.5: git-tfs push
1-265
Chapter 32: Empty directories in Git
1-266
Section 32.1: Git doesn't track directories
1-267
Chapter 33: git-svn
1-268
Section 33.1: Cloning the SVN repository
1-269
Section 33.2: Pushing local changes to SVN
1-270
Section 33.3: Working locally
1-271
Section 33.4: Getting the latest changes from SVN
1-272
Section 33.5: Handling empty folders
1-273
Chapter 34: Archive
1-274
Section 34.1: Create an archive of git repository
1-275
Section 34.2: Create an archive of git repository with directory prefix
1-276
Section 34.3: Create archive of git repository based on specific branch, revision, tag or directory
1-277
Chapter 35: Rewriting history with filter-branch
1-278
Section 35.1: Changing the author of commits
1-279
Section 35.2: Setting git committer equal to commit author
1-280
Chapter 36: Migrating to Git
1-281
Section 36.1: SubGit
1-282
Section 36.2: Migrate from SVN to Git using Atlassian conversion utility
1-283
Section 36.3: Migrating Mercurial to Git
1-284
Section 36.4: Migrate from Team Foundation Version Control (TFVC) to Git
1-285
Section 36.5: Migrate from SVN to Git using svn2git
1-286
Chapter 37: Show
1-287
Section 37.1: Overview
1-288
Chapter 38: Resolving merge conflicts
1-289
Section 38.1: Manual Resolution
1-290
Chapter 39: Bundles
1-291
Section 39.1: Creating a git bundle on the local machine and using it on another
1-292
Chapter 40: Display commit history graphically with Gitk
1-293
Section 40.1: Display commit history for one file
1-294
Section 40.2: Display all commits between two commits
1-295
Section 40.3: Display commits since version tag
1-296
Chapter 41: Bisecting/Finding faulty commits
1-297
Section 41.1: Binary search (git bisect)
1-298
Section 41.2: Semi-automatically find a faulty commit
1-299
Chapter 42: Blaming
1-300
Section 42.1: Only show certain lines
1-301
Section 42.2: To find out who changed a file
1-302
Section 42.3: Show the commit that last modified a line