The use of git and the gitee warehouse

1. Create a project
Local storage operation:
        2.git init initialization will generate a .git file in the project. It is a hidden file. Only when a folder
        is managed by git, can we use the function of git for version management.
        3. git add . Add all to the temporary storage area
        4. git commit -m "index" and put it in the history area.
        5. git reflog View all historical records
        6. git reset --hard xxx Roll back to the first submitted version
        git reset --hard plus the content after the commit obtained from the first submission
gitee:
        1. Create a warehouse
        2. Git global settings in the project terminal: only need to be configured once. No further configuration is required.
        git config --global user.name "**"
        git config --global user.email "**********"
        3. Set in the project terminal:
        // Add to the remote warehouse. Associate the local warehouse with the remote warehouse.
        git remote add origin https://gitee.com/SanerA/zsq-xiao-mi.

        Note: When using gitee for the first time, after the push, it will pop up to enter the user name and password
        User name: mobile phone number ****. Password: **** The entered content will be stored in the window credentials.
        If you make a mistake, you can delete it here, push it again, and enter the password.
        4. Note on deleting the warehouse: as long as you delete the git file, it is not a warehouse anymore.
        5. When making a login page
        
        6.git add .
        7.git commit -m "login"
        8.git pull
        9.push into the remote, just git push directly, no need to input: git push - u origin "master"
        
        6789 The git operation using vscode is to add changes--"remarks--"add history area--"click to synchronize (pull, push)
gitee cloning:
        Method 1:
        1. The project to be cloned in gitee Inside, there is a clone download, copy the link in https
        2. In vscode, create a new window, click clone git repository.
        
        Method 2:
        1. In the project to be cloned by gitee, there is a clone download, copy the link in https
        2. For example, download to the desktop. Right click on the desktop, click git bash here
        3. Enter the git clone address
gitee branch:
        1. The main branch is master, which is the main branch by default.
        2. After changing the default terminal cmd to a bash terminal, you can see the branch you are in.
        3. Under normal circumstances, it will not be developed on the main branch, and generally developed on the first branch.
        4. Develop a function in the feature-XXX
        step:
        1. Create a new branch git branch branch name such as: open a login branch: git branch dev4.0
        2. Jump from the main branch to the created branch: git checkout branch name such as:
        git checkout dev4.0
        3. Synchronize him to the remote warehouse.
        4. Create a new branch: git branch feature-login
        5. Enter the newly created branch: git checkout feature-login
        6. After the development is completed. First add the temporary storage area, then add the history area,
        7. After the development is completed, jump to the dev4.0 branch: git checkout dev4.0
        8. Merge the developed branch feature-login. git merge feature-login 9.         Delete the local branch
        after synchronizing to the remote warehouse : git branch -d dev View the branch: git branch -a

        The operation branch steps of the git branch of vscode:
        1. There is a branch in the three points of the git branch, click to create a branch, enter dev4.0, and
        synchronize to the remote warehouse after creation
        2. Click on the three points -- "check out to --"dev4.0
        3. Create a new branch: git branch feature-login
        4. Click three dots --" checkout to --" featurn-login
        5. Start to develop the function, after the development is completed. First add the temporary storage area, then add the historical area.
        6. Enter the dev4.0 branch: click three points -- "checkout to --" dev4.0
        7. Merge branch: click three points -- "branch --" merge branch -- "click the branch to be merged
        8. Click to synchronize to the remote warehouse

    Common branch names 1. master:         the main branch, which will
        always only store a version that can run stably, and cannot be directly developed on this branch.
Full version
        - including test version and stable version
        - do not develop on this branch
        3. feature-xxx: feature development branch, branch created from `develop`
        - mainly used for the development of a certain function
        - just name it after your own function , such as `feature-login` / `feature-list`
        - Merge into the `develop` branch after development
        4. feature-xxx-fix: After a `bug` occurs in a certain branch, open a `fix` in the current branch Branch
        - After solving the `bug`, merge into the current function branch
        - If the `bug` is found after the function branch has been merged, you can directly open the branch on `develop`
        - After the repair is completed, merge into the `develop` branch
        5. hotfix -xxx: For emergency `bug` repairs
        - open directly on the `master` branch
        - merge back to `master` after the repair is complete 
11. SSH download:
        Generate public key:
        1.ssh-keygen -t rsa -C "****@qq.com" #Generate public key You can use cmd computer terminal
        2.cat ~/.ssh/id_rsa.pub #View public key in Use
        the generated public key in git bash here
        <!-- 
        ssh-rsa...........................
         -->
    Add public key
        Add the public key to gitee
        3. https://gitee.com/profile/sshkeys In this URL, add the public key.
        4. Add the public key successfully, use SSH to download in the project clone download. Copy address
        5. Create a new vscode window, click Clone git repository, and enter the copied URL. You can clone
        successfully.
12. Ignore files You can ignore files that you don't want to submit, and files submitted to remote will not display ignored files 1.
        Ignore files Create a file. gitignore
        # Ignore this folder
        node_modules/
        # Ignore this file
        aa.js

13. In the bash terminal, clear the content of the command entered by the terminal. Ctrl+l clears the
current line. Enter the shortcut key: ctrl+u
linux command
   ls to view the files in the current directory
   cd folder to enter the folder
   mkdir create a directory
   touch a file to create a
   vi file to edit a file i insert press esc:wq exit and save
   cat file view file content
   rm -f file delete file

Guess you like

Origin blog.csdn.net/m0_53942074/article/details/125757893