If you are about to start with a new Java project in IntelliJ IDE and you want that project to be in a Git repository, follow the below steps,
- Open the IntelliJ IDE (I am using the Community Edition)
- Click on the New Project button.
- Select Empty Project from side bar.
- Add the name of the project.
- Make sure to click on "Create Git repository".
- Click create.
You will see that the project has a git branch created with a local main branch.
Once you create the first file for the project you will be prompted with "Do you want to add the following file to Git?"

Converting Existing non-version controlled Project into a Git Project
If you have an existing project that is not version controlled, you can simply open the project in IntelliJ and click on "Version Control" on the status bar and select the "Create a Git repository" option to convert it into a git repo.

Once the project is converted to a Git repo, you will see that the "Version Control" has changed to "Git"

Have Questions? Post them here!
- How to Get List of All Country Codes in Java Using Locale Class
- Unsupported major.minor version 52.0 in java
- Java - How to set custom thread name?
- Get the current timestamp in Java
- Java Spring Boot 3 Web Hello World with Gradle in IntelliJ
- [fix] NullPointerException Cannot Invoke findById because Repository is null - Java Spring
- java: unclosed string literal [Error]
- Convert Java Byte Array to String with code examples
- Error: Can not find the tag library descriptor for
- Java 8 - Convert List to Map Examples
- Java - Calculate time taken for the code to execute in milliseconds or nanoseconds
- Fix java.net.ProtocolException: Invalid HTTP method
- Java: Convert Stream to List
- Java equals method - Tutorial
- List of Java JDBC Database Driver Jars, Classes and URLs Details
- Read YAML file Java Jackson Library
- How to display Java Date Time timezone GMT/UTC offset using SimpleDateFormat
- List of Java Keywords
- Enable JSON Pretty Print in Java Jackson
- How to Word-Warp Console logs in IntelliJ
- Convert Map to List in Java 8 using Stream API
- Create a Directory using Java Code
- Ways to Convert Integer or int to Long in Java
- [Program] How to read three different values using Scanner in Java
- Java JDBC Example with Oracle Database Driver Connection
- Send Extra Data with Ajax Get or Post Request - JavaScript
- How to Enable or Disable Dark Mode on macOS Ventura 13 - MacOS
- [Fix] Microsoft Store Error Code: 0x803F8001 - Microsoft
- Get List of all local branches git command - Git
- Android Images with Rounded Corners : ImageView - Android
- [fix] command not found curl - cURL
- How to display Java Date Time timezone GMT/UTC offset using SimpleDateFormat - Java
- Error 404 Tomcat homepage http://localhost:8080/ not displayed - Tomcat