Git installed

  • Download and install the corresponding environment and register an account
  • Configuring a Git Account
    • Open git bash here
Ssh-keygen -t rsa-c Your email address// The carriage return is not includedOpen the secret key configured in Github at the location shownCopy the code

Git username and account Settings

  git config user.name 'Your username'
  git config user.email 'Your Email account'
  // Displays the current user information
  git config --list
Copy the code

Rebase usagecareful

  • The problem

2. It is not conducive to code review

  • Application scenarios

1. Merge multiple submission records

Git rebase --edit-todo git rebase --edit-todo git rebase --edit-todo Git rebase --continue //Copy the code

2. Merge branches

During development, new branches can be created to develop specific functions, Git checkout master git merge devCopy the code

3. Merge a commit to the specified branch

Git cherry-pick 62ecb3 // go to git checkout master // merge commitCopy the code

Download the clone project and associate it

Download the clone project three kinds of audacity

  • Create file + initialize local repository + bind cloud repository
Create a folder 2. Initialize the local repository git init 3. Bind the remote repository git remote add Local repository name (origin) Remote repository address (HTTPS :xxxx.git) 4. Git fetch Origin Master git fetch origin masterCopy the code
  • Git pull branches locally in two ways
    • Additional branch code exists locally
    Git branch -r 1 Git checkout -b local branch origin/ remote branch // Create a local branch and switch to the created branch and associate with the remote branch Git checkout -b "Local branch" is to create a local branch and switch to the created branch ============= equivalent ========== git branch Local branch git checkout local branch 2. This method requires that the branch be created locally now and switched to the specified branch. The code from the remote branch is fetched to the local branch (ps:** The remote branch does not connect to the local branch **) 3. Git clone -b git clone -b git clone -b git cloneCopy the code
  • Pulls a new branch created remotely
Git branch -r git branch -rCopy the code
  • Pass code from the local A branch to the remote B branch
Git push origin After the local branch is submitted 1. If the remote branch B exists (if the remote branch B does not exist, the remote branch B will be created) Git pull -b git pull -b git pull -b git pull -b git pull -b git pullCopy the code
  • Pulls the specified branch code for the remote
Git branch -vv git branch -vv git branch -vv git branch // Delete the local branch git branch -d local branch name // clear the local temporary commit to the specified branch git stashCopy the code
  • Git creates remote branches
Create a local branch and switch to the new branch dev git checkout -b dev //2 Git push origin dev //3 Git branch -- set-uppage-to =origin /dev/4 See git branchCopy the code

Submit the project

Git add. 2. Check whether the commit is successful git commit -m "// Support supports different types of content to be submitted. Shortcut keys For submission: CTRL + Shift + P // 1 3. Pull projects and merge (code is automatically merged as you pull) Git pull 4. 5. Add git Add.6 to your repository. Git merge --continue Git checkout -b new branch name: test 9 Git merge test git merge test Git Checkout 'branch name' 10 Git remote -v // git git git git git git git git git Remote add Origin remote add OriginCopy the code
  • Here is the shortcut key shift+ CTRL + P for submitting a screenshot of vscode installing the plugin

The Git version rolls back

  • Git code commit error, rollback code to specified version
// Check the record
git reflog
// Rollback to the specified submission version number, as shown in the screenshot below
git hard --reset 'Version number'
Copy the code

  • It is normal to have some problems in the process of pulling

Common system process commands

  • Specify a port

Netstat aon | findstr searches the port number

  • Check the process of the PID

Tasklist | findstr searches pid number

  • End the corresponding process

Taskkill /f /t /im Process ID/name