Use git to upload local code to github

Step 1: Create SSH Key. In the user's home directory, check if there is a .ssh directory. If so, check if there are two files, id_rsa and id_rsa.pub, in this directory. If there are already, you can skip to the next step. If not, open Shell (open Git Bash under Windows) and create SSH Key:

$ ssh-keygen -t rsa -C "your mailbox"

Find the .ssh directory in the user's home directory. There are two files id_rsa and id_rsa.pub. These two are the secret key pair of SSH Key. id_rsa is the private key and cannot be disclosed. id_rsa.pub is the public key, so you can rest assured Tell anyone.

 The following is to log in to github to add the public key

 After entering any Title, paste the content of the id_rsa.pub file in the Key text box:

 Create a warehouse on github and synchronize the local warehouse to github remotely

The following is essential:

The git status command is to query whether the files in the current folder have been modified 

git diff + (file name) is the code to query this file to modify

git diff HEAD - (file name) View the difference between the latest version in the workspace and the repository

git checkout --(file name) discard changes to the workspace

git add + (file name) Add the file to the warehouse and modify the file to the temporary storage area

git commit -m "Submit Instructions" Submit all the contents of the staging area to the current branch

git log displays the most recent commit log / git log --pretty=oneline

git reset --hard (version number) Return to the previously changed content version return

git reflog records every command

There are so many commonly used commands 

Guess you like

Origin blog.csdn.net/weixin_43407092/article/details/93601992