git basic commands

git command

  • The function of git init is to initialize a warehouse that can be managed by git. Use attrib -h .git to release hidden files.git

Create your own project file, open the project folder and then open the git command window in the folder

  • git add'file name' Submit a single file git add. Submit all modified files

  • git status can view the current installation of git. For example, after placing git add and executing the git status command, you can view the contents that have been modified currently.

  • git commit -m "Description content of this change" Because the description content needs to express the content of this modification, it is recommended to use the git repository when each function point is modified to complete the modification. git add is executed once. git commit -m "Description"

  • git log View the records used by git (log)

  • git log --pretty=oneline can make the log display in one line the log contains the log id + the submitted content description

  • git reset --hard HEAD^ to go back to the previous version

  • git reflog can view the record of each version control, you can use one of the id through git reset --hard id to return to the version before modification

  • Generate and set public key

  • The generated command ssh-keygen -t rsa -C "[email protected]" is recommended to fill in your own mailbox

  • After generating the public key, go to c://users/administrator/.ssh. There are two files in the folder. One is id_rsa, which is the private key. Don’t disclose it to others. id_rsa.pub is the public key. The public key must be set and the key can be made public.

  • Configure the public key and enter the official website of github=》 Hover the mouse on your avatar and you can see that there is a setting below, which is set. Click on the settings to enter the settings page. There is a ssh and GPG keys in the menu. Click it to start configuring the public key. Click new ssh Keys can start adding public keys by copying all the contents of id_rsa.pub into the public key

  • Then execute git clone [email protected] in your own project file: your git account name/fenghuangshan.git will clone the code of the remote library into the local folder
    https://github.com/wangjiawei11/fenghuangshan.git

  • Then execute git init to initialize the .git file

  • Can be executed when the file is modified

  • git add. Add modified content into the temporary storage area

  • git status view status

  • git commit -m "description"

  • git status view status

  • git pull until Already up to date appears

  • git push pushes local changes to the code base

  • The command to create a branch git branch branch name

  • Switch to a branch command git checkout branch name

  • The command to merge branches git merge branch name means to merge the code corresponding to the branch name to the current branch we are on, which means to bring other code to me

Guess you like

Origin blog.csdn.net/w19981225/article/details/108005963