Fundamentals 6 min read

Master Git Basics and IntelliJ IDEA Integration: A Complete Guide

This article introduces Git as a distributed version control system, explains its core workflow and branch model, and provides step‑by‑step instructions for configuring, cloning, checking out, committing, pushing, and using Git commands within IntelliJ IDEA, including useful screenshots.

Java Backend Technology
Java Backend Technology
Java Backend Technology
Master Git Basics and IntelliJ IDEA Integration: A Complete Guide

1. Git Overview

Git is a popular distributed version control system with local and remote repositories that operate independently unless merging or deleting. Most operations are performed locally, allowing commits and branch switching offline. It uses SHA‑1 hashes to detect corrupted or incomplete file transfers.

Git Basic Workflow

Git workflow diagram
Git workflow diagram

git clone – clone the remote master branch to a local repository.

git checkout – switch to a branch for development.

git add – add files to the staging area.

git commit – commit staged changes to the local repository.

git push – push local commits to the remote repository.

Git Branch Types

Primary branches

master – production‑ready code.

develop – latest development work, merged into master when stable.

Supporting branches

feature – new feature development, merged into develop or discarded.

release – small bug fixes and release preparation.

hotfix – urgent fixes.

2. Using Git in IntelliJ IDEA

2.1 Configure Git

Install Git locally and set up an SSH key.

In IntelliJ IDEA go to Settings → Version Control → Git, set the path to the Git executable and test the connection.

2.2 Clone a Repository

Use VCS → Git → Clone, enter the remote URL and test it.

Clone dialog
Clone dialog

2.3 Checkout a Branch

In the lower‑right corner of IDEA, select the desired branch to checkout. The UI shows local (1) and remote (2) versions.

Branch checkout
Branch checkout

2.4 View Differences

In Local Changes, right‑click a file and choose Show Diff; use Revert to discard changes.

Diff view
Diff view

2.5 View Commit Log

Open Version Control → Log to see the commit history.

Commit log
Commit log

2.6 Commit Changes

Modify files (e.g., pom.xml); they appear under Local Changes. Click the commit icon, write a message, and commit to the local repository.

Commit dialog
Commit dialog

2.7 Push to Remote

Use VCS → Git → Push to upload local commits.

Push dialog
Push dialog

2.8 Git Commands in IDEA Terminal

Press Alt+F12 to open the terminal. Common commands: git clone, git status, git checkout -b -t origin/ , git pull, git commit -am "msg", git merge , git push.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

software developmentGitIntelliJ IDEAcommand-lineVersion Controlbranching
Java Backend Technology
Written by

Java Backend Technology

Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.