Table of Contents

  • 1  series
  • 2  Git instructions
  • 3  Git git
    • 3.1  Basic operation
    • 3.2  Remote operation
  • 4  Check git configuration
    • 4.1  View the configured items
    • 4.2  Other configuration
  • 5  Description of branches in Git
  • 6  Git tag
  • 7  Ignore some files during git status verification
  • 8  Batch git add several files
  • 9  Git rm files in batches
  • 10  Git is too slow
    • 10.1  Windows (Win10)
    • 10.2  – On Linux (centos)

series

✓ Monitor your github changes, where you want to see them, by ✓ ✓

Git instructions

  • This article mainly introduces git common commands, such as add, commit, push, merge, pull etc. This paper introduces how to deal with the slow download speed of Git.

  • Git Basics

    • Workspace: your local working directory;
    • Staging area: after git add, the file reaches the staging area;
    • Repository: After git commit, you reach the repository (the local repository);
    • Remote repository: Github or other remote repository

Git git

  • Any command that involves direct changes to the workspace should be treated with caution, as it is overwritten

Basic operation

  • This section describes git commands such as reset, checkout, diff, and log

  • Git diff example

Remote operation

Check git configuration

View the configured items

git config --list
Copy the code

Other configuration

  • Configure the user name and password
  • Configure the difference analysis tool:git config --global merge.tool vimdiff

Description of branches in Git

  • Matters needing attention
    • When, in accordance with thegit branch blogsAfter creating a branch, no matter what changes or commits are made in the home directory, when we switch to the Blogs branch,
    • The workspace will be restored to what it looked like when we created the blog branch.
    • The changes we make in the branch will be reset when we go back to the other branch

  • Git branch instances

Git tag

  • If you reach an important stage and want to remember that particular commit snapshot forever, you can tag it with a Git tag

Ignore some files during git status verification

  • The original situation

  1. Set the gitignore section
.ipynb_c*/*
git_up*
Copy the code
git rm -r --cached .
git add .gitignore
git add .
git commit -m "fixing .gitignore"
Copy the code
  • Git add and git status will no longer contain files of the same type

Batch git add several files

git add 08_git/*.md
Copy the code

Git rm files in batches

git rm */.ipynb_c*/*
Copy the code

Git is too slow

Windows (Win10)

  1. Go to the C:\Windows\System32\drivers\etc folder and open the hosts file
  2. Enter web IP address query query github.global.ssl.fastly.net and github.com domain names corresponding IP address
  3. Write the query results to the end of the hosts file
# github
ip1 github.com
ip2 github.global.ssl.fastly.net
Copy the code
  1. Open the CMD
ipconfig /flushdns
Copy the code

On Linux (centos)

  1. yum -y install bind-utilsInstall the nslookup
  2. Query the github domain name
nslookup github.global.ssl.fastly.Net
nslookup github.com 
Copy the code
  1. Modifying a Configuration File
vi /etc/hosts
ip http://global-ssl.fastly.net 
ip http://github.com 
Copy the code
  1. The refresh
You can choose rebootCopy the code