135.3 Using Git in an IDE and CLI

Compare using Git from within your IDE and from the command line, and learn how to switch between both in a typical development workflow.

The diagram below demonstrates the Git workflow and the key commands. In this topic, we focus on initiating these commands from the CLI and/or the IDE.

IDE vs CLI: Two ways to use Git

You can use Git in two main ways:

  • Inside your IDE (e.g. PyCharm, VS Code) Buttons, menus, and file change indicators help you use Git visually.

  • Using the command line (CLI) You type Git commands directly into a terminal.

Both approaches serve the same purpose—but understanding both provides you with flexibility and confidence as a developer.

Git in an IDE

Most modern IDEs come with Git integration. You can:

  • See which files have changed

  • Add files to a commit with a tick box

  • Type a commit message and press "Commit"

  • Push and pull with a single button

  • View history and branches visually

Advantages

  • Beginner-friendly

  • Less risk of syntax errors

  • Useful during merge conflicts or reviews

Example: Git in PyCharm

  • Changes tab shows files that have been edited

  • Green tick = tracked and unchanged

  • Blue = modified

  • + = new untracked file

  • Click Commit to stage and commit

  • Use the Git menu to push and pull

Git in the command line

The CLI gives you complete control over Git and works in any environment (even without an IDE). You use short commands to manage version control:

git status              # See what's changed
git add file.py         # Stage a file
git commit -m "Message" # Commit changes
git push origin main    # Push to remote
git pull origin main    # Pull from remote

Advantages

  • Works in any terminal, even without an IDE

  • Easier to learn scripting and automation

  • Required for some advanced Git features

Common Git commands

Command
Description

git init

Create a new Git repo

git status

Show file changes

git add <file>

Stage file(s) for commit

git commit -m "Message"

Save changes with a message

git push origin <branch>

Upload changes to GitHub

git pull origin <branch>

Download changes from GitHub

git log

View commit history

Switching between them

It’s common to use both the CLI and IDE depending on the task:

  • Use your IDE for everyday changes, commits, and merges.

  • Use the CLI when:

    • The IDE doesn’t support a command (e.g. git stash)

    • You’re scripting or working remotely

    • You need to fix complex issues

Both tools use the same Git repository, so you can switch between them any time.

Summary

  • Your IDE simplifies Git workflows with buttons and menus.

  • The CLI gives you complete control through Git commands.

  • Both work on the same project and can be used together.

  • Learning both makes you a more flexible and confident developer.

Last updated

Was this helpful?