SpringBoot e-Commerce project mall (20K + STAR) address: github.com/macrozheng/…

Abstract

Git client is built into IDEA, which allows you to operate without using Git commands. This article will describe some common Git operations in IDEA.

Environment to prepare

  • You need to install a remote Git repository and a local Git client. For details, see setting up your Own Git repository in 10 minutes.
  • Because the Git plug-in in IDEA depends on the local Git client, you need to perform the following configuration:

Operation process

Here we use the source code of the Mall – Tiny project to demonstrate, as far as possible, a formal operation flow.

Create a project in Gitlab and add the README file

Clone project to local

  • Open the screen for checking out projects from Git:

  • Enter Git address to check out:

  • IDEA project will not be generated because the project has not been initialized:

Initialize the project and commit the code

  • Copy the code for mall-Tiny into this directory:

  • Here we need a.gitignore file to prevent some IDEA auto-generated code from being committed to Git repositories:
# Maven #
target/

# IDEA #
.idea/
*.iml

# Eclipse #
.settings/
.classpath
.project
Copy the code
  • Open the project with IDEA:

  • Right-click the project to open the menu and add all files to the staging area:

  • Add comments and submit code:

Push the code to the remote repository

  • Click push button push code:

  • Confirm push content:

  • The remote repository has been committed:

Pull code from the remote repository

  • Add a readme-test.md file to the remote repository:

  • Pull code from remote repository:

  • Confirm pull branch information:

Create branches from the local and push them to the remote

  • To create a dev branch locally, click the Git:master button in the lower right corner:

  • Push the local dev branch to the remote using push:

  • Confirm push content:

  • The dev branch has been created in the remote repository:

The branch switch

  • Switch from dev to master:

Git file conflict resolved

  • Modify remote repository code:

  • Modify the local repository code:

  • Click Merge to Merge the local repository code:

  • Click the arrow to merge the left and right codes into the middle area:

  • After the conflict merge is complete, click Apply to Apply:

  • Submit the code and push it remotely.

Merge code from dev branch to master

  • Change dev branch code in remote repository:

  • To pull the code from the local repository, choose to pull from the dev branch and merge:

  • Conflicts are found, resolved, submitted and pushed to the remote repository.

View Git repository commit history

The public,

Mall project full set of learning tutorials serialized, attention to the public number the first time access.