Course Tonight

Course Tonight

Did You Know?

We design Docy for the readers, optimizing not for page views or engagement

Git

Estimated reading: 11 minutes 14 views

Contents

  • Chapter 1: Getting started with Git

    • Section 1.1: Create your first repository, then add and commit files
    • Section 1.2: Clone a repository
    • Section 1.3: Sharing code
    • Section 1.4: Setting your user name and email
    • Section 1.5: Setting up the upstream remote
    • Section 1.6: Learning about a command
    • Section 1.7: Set up SSH for Git
    • Section 1.8: Git Installation
  • Chapter 2: Browsing the history

    • Section 2.1: “Regular” Git Log
    • Section 2.2: Prettier log
    • Section 2.3: Colorize Logs
    • Section 2.4: Oneline log
    • Section 2.5: Log search
    • Section 2.6: List all contributions grouped by author name
    • Section 2.7: Searching commit string in git log
    • Section 2.8: Log for a range of lines within a file
    • Section 2.9: Filter logs
    • Section 2.10: Log with changes inline
    • Section 2.11: Log showing committed files
    • Section 2.12: Show the contents of a single commit
    • Section 2.13: Git Log Between Two Branches
    • Section 2.14: One line showing committer name and time since commit
  • Chapter 3: Working with Remotes

    • Section 3.1: Deleting a Remote Branch
    • Section 3.2: Changing Git Remote URL
    • Section 3.3: List Existing Remotes
    • Section 3.4: Removing Local Copies of Deleted Remote Branches
    • Section 3.5: Updating from Upstream Repository
    • Section 3.6: ls-remote
    • Section 3.7: Adding a New Remote Repository
    • Section 3.8: Set Upstream on a New Branch
    • Section 3.9: Getting Started
    • Section 3.10: Renaming a Remote
    • Section 3.11: Show information about a Specific Remote
    • Section 3.12: Set the URL for a Specific Remote
    • Section 3.13: Get the URL for a Specific Remote
    • Section 3.14: Changing a Remote Repository
  • Chapter 4: Staging

    • Section 4.1: Staging All Changes to Files
    • Section 4.2: Unstage a file that contains changes
    • Section 4.3: Add changes by hunk
    • Section 4.4: Interactive add
    • Section 4.5: Show Staged Changes
    • Section 4.6: Staging A Single File
    • Section 4.7: Stage deleted files
  • Chapter 5: Ignoring Files and Folders

    • Section 5.1: Ignoring files and directories with a .gitignore file
    • Section 5.2: Checking if a file is ignored
    • Section 5.3: Exceptions in a .gitignore file
    • Section 5.4: A global .gitignore file
    • Section 5.5: Ignore files that have already been committed to a Git repository
    • Section 5.6: Ignore files locally without committing ignore rules
    • Section 5.7: Ignoring subsequent changes to a file (without removing it)
    • Section 5.8: Ignoring a file in any directory
    • Section 5.9: Prefilled .gitignore Templates
    • Section 5.10: Ignoring files in subfolders (Multiple gitignore files)
    • Section 5.11: Create an Empty Folder
    • Section 5.12: Finding files ignored by .gitignore
    • Section 5.13: Ignoring only part of a file [stub]
    • Section 5.14: Ignoring changes in tracked files [stub]
    • Section 5.15: Clear already committed files, but included in .gitignore
  • Chapter 6: Git Diff

    • Section 6.1: Show differences in working branch
    • Section 6.2: Show changes between two commits
    • Section 6.3: Show differences for staged files
    • Section 6.4: Comparing branches
    • Section 6.5: Show both staged and unstaged changes
    • Section 6.6: Show differences for a specific file or directory
    • Section 6.7: Viewing a word-diff for long lines
    • Section 6.8: Show differences between current version and last version
    • Section 6.9: Produce a patch-compatible diff
    • Section 6.10: Difference between two commit or branch
    • Section 6.11: Using meld to see all modifications in the working directory
    • Section 6.12: Diff UTF-16 encoded text and binary plist files
  • Chapter 7: Undoing

    • Section 7.1: Return to a previous commit
    • Section 7.2: Undoing changes
    • Section 7.3: Using reflog
    • Section 7.4: Undoing merges
    • Section 7.5: Revert some existing commits
    • Section 7.6: Undo / Redo a series of commits
  • Chapter 8: Merging

    • Section 8.1: Automatic Merging
    • Section 8.2: Finding all branches with no merged changes
    • Section 8.3: Aborting a merge
    • Section 8.4: Merge with a commit
    • Section 8.5: Keep changes from only one side of a merge
    • Section 8.6: Merge one branch into another
  • Chapter 9: Submodules

    • Section 9.1: Cloning a Git repository having submodules
    • Section 9.2: Updating a Submodule
    • Section 9.3: Adding a submodule
    • Section 9.4: Setting a submodule to follow a branch
    • Section 9.5: Moving a submodule
    • Section 9.6: Removing a submodule
  • Chapter 10: Committing

    • Section 10.1: Stage and commit changes
    • Section 10.2: Good commit messages
    • Section 10.3: Amending a commit
    • Section 10.4: Committing without opening an editor
    • Section 10.5: Committing changes directly
    • Section 10.6: Selecting which lines should be staged for committing
    • Section 10.7: Creating an empty commit
    • Section 10.8: Committing on behalf of someone else
    • Section 10.9: GPG signing commits
    • Section 10.10: Committing changes in specific files
    • Section 10.11: Committing at a specific date
    • Section 10.12: Amending the time of a commit
    • Section 10.13: Amending the author of a commit
  • Chapter 11: Aliases

    • Section 11.1: Simple aliases
    • Section 11.2: List / search existing aliases
    • Section 11.3: Advanced Aliases
    • Section 11.4: Temporarily ignore tracked files
    • Section 11.5: Show pretty log with branch graph
    • Section 11.6: See which files are being ignored by your .gitignore configuration
    • Section 11.7: Updating code while keeping a linear history
    • Section 11.8: Unstage staged files
  • Chapter 12: Rebasing

    • Section 12.1: Local Branch Rebasing
    • Section 12.2: Rebase: ours and theirs, local and remote
    • Section 12.3: Interactive Rebase
    • Section 12.4: Rebase down to the initial commit
    • Section 12.5: Configuring autostash
    • Section 12.6: Testing all commits during rebase
    • Section 12.7: Rebasing before a code review
    • Section 12.8: Aborting an Interactive Rebase
    • Section 12.9: Setup git-pull for automatically performing a rebase instead of a merge
    • Section 12.10: Pushing after a rebase
  • Chapter 13: Configuration

    • Section 13.1: Setting which editor to use
    • Section 13.2: Auto-correct typos
    • Section 13.3: List and edit the current configuration
    • Section 13.4: Username and email address
    • Section 13.5: Multiple usernames and email address
    • Section 13.6: Multiple git configurations
    • Section 13.7: Configuring line endings
    • Section 13.8: Configuration for one command only
    • Section 13.9: Setup a proxy
  • Chapter 14: Branching

    • Section 14.1: Creating and checking out new branches
    • Section 14.2: Listing branches
    • Section 14.3: Delete a remote branch
    • Section 14.4: Quick switch to the previous branch
    • Section 14.5: Check out a new branch tracking a remote branch
    • Section 14.6: Delete a branch locally
    • Section 14.7: Create an orphan branch (i.e., branch with no parent commit)
    • Section 14.8: Rename a branch
    • Section 14.9: Searching in branches
    • Section 14.10: Push branch to remote
    • Section 14.11: Move current branch HEAD to an arbitrary commit
  • Chapter 15: Rev-List

    • Section 15.1: List Commits in master but not in origin/master
  • Chapter 16: Squashing

    • Section 16.1: Squash Recent Commits Without Rebasing
    • Section 16.2: Squashing Commit During Merge
    • Section 16.3: Squashing Commits During a Rebase
    • Section 16.4: Autosquashing and fixups
    • Section 16.5: Autosquash: Committing code you want to squash during a rebase
  • Chapter 17: Cherry Picking

    • Section 17.1: Copying a commit from one branch to another
    • Section 17.2: Copying a range of commits from one branch to another
    • Section 17.3: Checking if a cherry-pick is required
    • Section 17.4: Find commits yet to be applied to upstream
  • Chapter 18: Recovering

    • Section 18.1: Recovering from a reset
    • Section 18.2: Recover from git stash
    • Section 18.3: Recovering from a lost commit
    • Section 18.4: Restore a deleted file after a commit
    • Section 18.5: Restore file to a previous version
    • Section 18.6: Recover a deleted branch
  • Chapter 19: Git Clean

    • Section 19.1: Clean Interactively
    • Section 19.2: Forcefully remove untracked files
    • Section 19.3: Clean Ignored Files
    • Section 19.4: Clean All Untracked Directories
  • Chapter 20: Using a .gitattributes file

    • Section 20.1: Automatic Line Ending Normalization
    • Section 20.2: Identify Binary Files
    • Section 20.3: Prefilled .gitattribute Templates
    • Section 20.4: Disable Line Ending Normalization
  • Chapter 21: .mailmap file: Associating contributor and email aliases

    • Section 21.1: Merge contributors by aliases to show commit count in shortlog
  • Chapter 22: Analyzing types of workflows

    • Section 22.1: Centralized Workflow
    • Section 22.2: Gitflow Workflow
    • Section 22.3: Feature Branch Workflow
    • Section 22.4: GitHub Flow
    • Section 22.5: Forking Workflow
  • Chapter 23: Pulling

    • Section 23.1: Pulling changes to a local repository
    • Section 23.2: Updating with local changes
    • Section 23.3: Pull, overwrite local
    • Section 23.4: Pull code from remote
    • Section 23.5: Keeping linear history when pulling
    • Section 23.6: Pull, “permission denied”
  • Chapter 24: Hooks

    • Section 24.1: Pre-push
    • Section 24.2: Verify Maven build (or other build system) before committing
    • Section 24.3: Automatically forward certain pushes to other repositories
    • Section 24.4: Commit-msg
    • Section 24.5: Local hooks
    • Section 24.6: Post-checkout
    • Section 24.7: Post-commit
    • Section 24.8: Post-receive
    • Section 24.9: Pre-commit
    • Section 24.10: Prepare-commit-msg
    • Section 24.11: Pre-rebase
    • Section 24.12: Pre-receive
    • Section 24.13: Update
  • Chapter 25: Cloning Repositories

    • Section 25.1: Shallow Clone
    • Section 25.2: Regular Clone
    • Section 25.3: Clone a specific branch
    • Section 25.4: Clone recursively
    • Section 25.5: Clone using a proxy
  • Chapter 26: Stashing

    • Section 26.1: What is Stashing?
    • Section 26.2: Create stash
    • Section 26.3: Apply and remove stash
    • Section 26.4: Apply stash without removing it
    • Section 26.5: Show stash
    • Section 26.6: Partial stash
    • Section 26.7: List saved stashes
    • Section 26.8: Move your work in progress to another branch
    • Section 26.9: Remove stash
    • Section 26.10: Apply part of a stash with checkout
    • Section 26.11: Recovering earlier changes from stash
    • Section 26.12: Interactive Stashing
    • Section 26.13: Recover a dropped stash
  • Chapter 27: Subtrees

    • Section 27.1: Create, Pull, and Backport Subtree
  • Chapter 28: Renaming

    • Section 28.1: Rename Folders
    • Section 28.2: Rename a local and the remote branch
    • Section 28.3: Renaming a local branch
  • Chapter 29: Pushing

    • Section 29.1: Push a specific object to a remote branch
    • Section 29.2: Push
    • Section 29.3: Force Pushing
    • Section 29.4: Push tags
    • Section 29.5: Changing the default push behavior
  • Chapter 30: Internals

    • Section 30.1: Repo
    • Section 30.2: Objects
    • Section 30.3: HEAD ref
    • Section 30.4: Refs
    • Section 30.5: Commit Object
    • Section 30.6: Tree Object
    • Section 30.7: Blob Object
    • Section 30.8: Creating new Commits
    • Section 30.9: Moving HEAD
    • Section 30.10: Moving refs around
    • Section 30.11: Creating new Refs
  • Chapter 31: git-tfs

    • Section 31.1: git-tfs clone
    • Section 31.2: git-tfs clone from bare git repository
    • Section 31.3: git-tfs install via Chocolatey
    • Section 31.4: git-tfs Check In
    • Section 31.5: git-tfs push
  • Chapter 32: Empty directories in Git

    • Section 32.1: Git doesn’t track directories
  • Chapter 33: git-svn

    • Section 33.1: Cloning the SVN repository
    • Section 33.2: Pushing local changes to SVN
    • Section 33.3: Working locally
    • Section 33.4: Getting the latest changes from SVN
    • Section 33.5: Handling empty folders
  • Chapter 34: Archive

    • Section 34.1: Create an archive of git repository
    • Section 34.2: Create an archive of git repository with directory prefix
    • Section 34.3: Create archive of git repository based on specific branch, revision, tag or directory
  • Chapter 35: Rewriting history with filter-branch

    • Section 35.1: Changing the author of commits
    • Section 35.2: Setting git committer equal to commit author
  • Chapter 36: Migrating to Git

    • Section 36.1: SubGit
    • Section 36.2: Migrate from SVN to Git using Atlassian conversion utility
    • Section 36.3: Migrating Mercurial to Git
    • Section 36.4: Migrate from Team Foundation Version Control (TFVC) to Git
    • Section 36.5: Migrate from SVN to Git using svn2git
  • Chapter 37: Show

    • Section 37.1: Overview
  • Chapter 38: Resolving merge conflicts

    • Section 38.1: Manual Resolution
  • Chapter 39: Bundles

    • Section 39.1: Creating a git bundle on the local machine and using it on another
  • Chapter 40: Display commit history graphically with Gitk

    • Section 40.1: Display commit history for one file
    • Section 40.2: Display all commits between two commits
    • Section 40.3: Display commits since version tag
  • Chapter 41: Bisecting/Finding faulty commits

    • Section 41.1: Binary search (git bisect)
    • Section 41.2: Semi-automatically find a faulty commit
  • Chapter 42: Blaming

    • Section 42.1: Only show certain lines
    • Section 42.2: To find out who changed a file
    • Section 42.3: Show the commit that last modified a line
    • Section 42.4: Ignore whitespace-only changes
  • Chapter 43: Git revisions syntax

    • Section 43.1: Specifying revision by object name
    • Section 43.2: Symbolic ref names: branches, tags, remote-tracking branches
    • Section 43.3: The default revision: HEAD
    • Section 43.4: Reflog references: <refname>@{<n>}
    • Section 43.5: Reflog references: <refname>@{<date>}
    • Section 43.6: Tracked / upstream branch: <branchname>@{upstream}
    • Section 43.7: Commit ancestry chain: <rev>^, <rev>~<n>, etc
    • Section 43.8: Dereferencing branches and tags: <rev>^0, <rev>^{<type>}
    • Section 43.9: Youngest matching commit: <rev>^{/<text>}, :/<text>
  • Chapter 44: Worktrees

    • Section 44.1: Using a worktree
    • Section 44.2: Moving a worktree
  • Chapter 45: Git Remote

    • Section 45.1: Display Remote Repositories
    • Section 45.2: Change remote URL of your Git repository
    • Section 45.3: Remove a Remote Repository
    • Section 45.4: Add a Remote Repository
    • Section 45.5: Show more information about remote repository
    • Section 45.6: Rename a Remote Repository
  • Chapter 46: Git Large File Storage (LFS)

    • Section 46.1: Declare certain file types to store externally
    • Section 46.2: Set LFS config for all clones
    • Section 46.3: Install LFS
  • Chapter 47: Git Patch

    • Section 47.1: Creating a patch
    • Section 47.2: Applying patches
  • Chapter 48: Git statistics

    • Section 48.1: Lines of code per developer
    • Section 48.2: Listing each branch and its last revision’s date
    • Section 48.3: Commits per developer
    • Section 48.4: Commits per date
    • Section 48.5: Total number of commits in a branch
    • Section 48.6: List all commits in pretty format
    • Section 48.7: Find all local Git repositories on computer
    • Section 48.8: Show the total number of commits per author
  • Chapter 49: git send-email

    • Section 49.1: Use git send-email with Gmail
    • Section 49.2: Composing
    • Section 49.3: Sending patches by mail
  • Chapter 50: Git GUI Clients

    • Section 50.1: gitk and git-gui
    • Section 50.2: GitHub Desktop
    • Section 50.3: Git Kraken
    • Section 50.4: SourceTree
    • Section 50.5: Git Extensions
    • Section 50.6: SmartGit
  • Chapter 51: Reflog – Restoring commits not shown in git log

    • Section 51.1: Recovering from a bad rebase
  • Chapter 52: TortoiseGit

    • Section 52.1: Squash commits
    • Section 52.2: Assume unchanged
    • Section 52.3: Ignoring Files and Folders
    • Section 52.4: Branching
  • Chapter 53: External merge and diff tools

    • Section 53.1: Setting up KDiff3 as merge tool
    • Section 53.2: Setting up KDiff3 as diff tool
    • Section 53.3: Setting up an IntelliJ IDE as merge tool (Windows)
    • Section 53.4: Setting up an IntelliJ IDE as diff tool (Windows)
    • Section 53.5: Setting up Beyond Compare
  • Chapter 54: Update Object Name in Reference

    • Section 54.1: Update Object Name in Reference
  • Chapter 55: Git Branch Name on Bash Ubuntu

    • Section 55.1: Branch Name in terminal
  • Chapter 56: Git Client-Side Hooks

    • Section 56.1: Git pre-push hook
    • Section 56.2: Installing a Hook
  • Chapter 57: Git rerere

    • Section 57.1: Enabling rerere
  • Chapter 58: Change git repository name

    • Section 58.1: Change local setting
  • Chapter 59: Git Tagging

    • Section 59.1: Listing all available tags
    • Section 59.2: Create and push tag(s) in Git
  • Chapter 60: Tidying up your local and remote repository

    • Section 60.1: Delete local branches that have been deleted on the remote
  • Chapter 61: diff-tree

    • Section 61.1: See the files changed in a specific commit
    • Section 61.2: Usage
    • Section 61.3: Common diff options
Chapter 1: Getting started with Git
Chapter 1: Getting started with Git

Section 1.1: Create your first repository, then add and commit files At

Chapter 2: Browsing the history
Chapter 2: Browsing the history

-q, --quiet: This parameter suppresses the diff output and makes the command

Chapter 3: Working with Remotes
Chapter 3: Working with Remotes

Section 3.1: Deleting a Remote Branch To delete a remote branch in

Chapter 4: Staging
Chapter 4: Staging

Section 4.1: Staging All Changes to Files To stage all changes to

Chapter 5: Ignoring Files and Folders
Chapter 5: Ignoring Files and Folders

This chapter discusses how to avoid adding unwanted files or file changes

Chapter 6: Git Diff
Chapter 6: Git Diff

Parameter Details -p, -u, --patch Generate patch. Suppress diff output. Useful for

Chapter 7: Undoing
Chapter 7: Undoing

Section 7.1: Return to a previous commit To jump back to a

Chapter 8: Merging
Chapter 8: Merging

Parameter Details -m Message to be included in the merge commit -v

Chapter 9: Submodules
Chapter 9: Submodules

Section 9.1: Cloning a Git repository having submodules When you clone a

Chapter 10: Committing
Chapter 10: Committing

Parameter Details --message, -m Message to include in the commit. Specifying this

Chapter 11: Aliases
Chapter 11: Aliases

Section 11.1: Simple aliases There are two ways of creating aliases in

Chapter 12: Rebasing
Chapter 12: Rebasing

Parameter: –continue Restart the rebasing process after having resolved a merge conflict.

Chapter 13: Configuration
Chapter 13: Configuration

Parameter Details --system Edits the system-wide configuration file, used for every user

Chapter 14: Branching
Chapter 14: Branching

Parameter Details -d, --delete Delete a branch. The branch must be fully

Chapter 15: Rev-List
Chapter 15: Rev-List

Parameter Details –oneline Display commits as a single line with their title.

Chapter 16: Squashing
Chapter 16: Squashing

Section 16.1: Squash Recent Commits Without Rebasing If you want to squash

Chapter 17: Cherry Picking
Chapter 17: Cherry Picking

Parameters: -e, --edit: With this option, git cherry-pick will let you edit

Chapter 18: Recovering
Chapter 18: Recovering

Section 18.1: Recovering from a reset With Git, you can (almost) always

Chapter 19: Git Clean
Chapter 19: Git Clean

Parameter Details -d Remove untracked directories in addition to untracked files. If

Chapter 20: Using a .gitattributes file
Chapter 20: Using a .gitattributes file

Section 20.1: Automatic Line Ending Normalization Create a .gitattributes file in the

Chapter 21: .mailmap file: Associating contributor and email aliases
Chapter 21: .mailmap file: Associating contributor and email aliases

Section 21.1: Merge contributors by aliases to show commit count in shortlog

Chapter 22: Analyzing types of workflows
Chapter 22: Analyzing types of workflows

Section 22.1: Centralized Workflow With this fundamental workflow model, a master branch

Chapter 23: Pulling
Chapter 23: Pulling

Parameters Details –quiet No text output -q Shorthand for –quiet –verbose Verbose

Chapter 24: Hooks
Chapter 24: Hooks

Section 24.1: Pre-push Available in Git 1.8.2 and above. Version ≥ 1.8

Chapter 25: Cloning Repositories
Chapter 25: Cloning Repositories

Section 25.1: Shallow Clone Cloning a huge repository (like a project with

Chapter 26: Stashing
Chapter 26: Stashing

Parameter Details show Show the changes recorded in the stash as a

Chapter 27: Subtrees
Chapter 27: Subtrees

Section 27.1: Create, Pull, and Backport Subtree Create Subtree: Add a new

Chapter 28: Renaming
Chapter 28: Renaming

Parameter Details -f or –force Force renaming or moving of a file

Chapter 29: Pushing
Chapter 29: Pushing

Parameter Details –force Overwrites the remote ref to match your local ref.

Chapter 30: Internals
Chapter 30: Internals

Section 30.1: Repo A git repository is an on-disk data structure that

Chapter 31: git-tfs
Chapter 31: git-tfs

Section 31.1: git-tfs clone To clone a TFVS project using git-tfs, use

Chapter 32: Empty directories in Git
Chapter 32: Empty directories in Git

Section 32.1: Git doesn’t track directories When using Git, it’s important to

Chapter 33: git-svn
Chapter 33: git-svn

Section 33.1: Cloning the SVN repository To create a new local copy

Chapter 34: Archive
Chapter 34: Archive

Parameter Details --format=<fmt> Format of the resulting archive: tar or zip. If

Chapter 35: Rewriting history with filter-branch
Chapter 35: Rewriting history with filter-branch

Section 35.1: Changing the author of commits You can use an environment

Chapter 36: Migrating to Git
Chapter 36: Migrating to Git

Section 36.1: SubGit SubGit may be used to perform a one-time import

Chapter 37: Show
Chapter 37: Show

Section 37.1: Overview git show is a command that displays various Git

Chapter 38: Resolving merge conflicts
Chapter 38: Resolving merge conflicts

Section 38.1: Manual Resolution While performing a git merge, you may encounter

Chapter 39: Bundles
Chapter 39: Bundles

Section 39.1: Creating a git bundle on the local machine and using

Chapter 40: Display commit history graphically with Gitk
Chapter 40: Display commit history graphically with Gitk

Section 40.1: Display commit history for one file To display the commit

Chapter 41: Bisecting/Finding faulty commits
Chapter 41: Bisecting/Finding faulty commits

Section 41.1: Binary search (git bisect) To find the commit that introduced

Chapter 42: Blaming
Chapter 42: Blaming

Parameter Details filename Name of the file for which details need to

Chapter 43: Git Revisions Syntax
Chapter 43: Git Revisions Syntax

Section 43.1: Specifying revision by object name $ git show dae86e1950b1277e545cee180551750029cfe735 $

Chapter 44: Worktrees
Chapter 44: Worktrees

Parameter Details -f, –force By default, add refuses to create a new

Chapter 45: Git Remote
Chapter 45: Git Remote

Parameter Details -v, –verbose Run verbosely. -m <master> Sets head to remote’s

Chapter 46: Git Large File Storage (LFS)
Chapter 46: Git Large File Storage (LFS)

Section 46.1: Declare certain file types to store externally A common workflow

Chapter 47: Git Patch
Chapter 47: Git Patch

Parameter Details `<mbox> <Maildir>`… -s, –signoff Add a Signed-off-by: line to the

Chapter 48: Git Statistics
Chapter 48: Git Statistics

Parameter Details -n, --numbered Sort output according to the number of commits

Leave a Comment

Share this Doc

Git

Or copy link

CONTENTS