Introduction to Git Use

Time:2019-7-7

To be continued

I. Basic concepts

Common orders

1. Quick Lookup Table of Common Commands

Introduction to Git Use

2. Quick Lookup Table of Common Commands (Chinese)

Introduction to Git Use

Scene Application

1. Configure Git account

Priority: Engineering Level > User Level > System Level

  • System-level configuration

    • System contains generic configurations for users and their warehouses that are not on the system
    • Located at / etc / gitconfig
  • User-level configuration

    • –Global only for current users
    • Located at ~/.git config or ~/.config/git/config
  • Engineering Level Configuration

    • Only for the current warehouse
    • Git/config in the current warehouse
  • View Git configuration

    git config user.name
    git config user.email
  • Add global configuration

    # Git global setup
    git config --global user.name "example"
    git config --global user.email "[email protected]"

2. Creating an initial warehouse

Scenario: The initial warehouse content is empty, and the file content needs to be added to the initial warehouse. Here are two ways to add:
1. Clone the empty warehouse, enter the corresponding folder to add files and upload files.
2. Existing project files to be uploaded are entered into the folder and uploaded as warehouse contents.

  • Flow chart
    Introduction to Git Use
  • Operational steps

    • Create new directories and files and upload them to the warehouse

      # Create a new repository
      git clone http://192.168.193.131/practice/project.git
      cd project
      touch README.md
      git add README.md
      git commit -m "add README"
      git push -u origin master
    • Existing directories and files are uploaded to the warehouse

      # Existing folder or Git repository
      cd existing_folder
      git init
      git remote add origin http://192.168.193.131/practice/project.git
      git add .
      git commit
      git push -u origin master

3. Get the version of the specified tag

Get the branch version of openwrt tag v18.06.2

  • Tag version
    Introduction to Git Use
  • Git command

    git clone --branch v18.06.2 https://git.openwrt.org/openwrt/openwrt.git

IV. References

Recommended Today

Deeply analyze the principle and practice of RSA key

1、 Preface After experiencing many dark moments in life, when you read this article, you will regret and even be angry: why didn’t you write this article earlier?! Your darkest moments include: 1. Your project needs to be connected with the bank, and the other party needs you to provide an encryption certificate. You have […]