If you’re new to Git, the command-line interface — also known as Git Terminal or Git Bash — might seem intimidating. But once you learn the basics, you’ll see it’s one of the most powerful tools in a developer’s toolkit.
This blog will walk you through how to use Git Terminal, covering essential commands and workflows to help you get started with Git like a pro.
🧰 What Is Git Terminal?
Git Terminal (commonly called Git Bash on Windows) is a command-line interface that lets you interact with Git repositories using commands. It’s part of the Git for Windows package and supports Unix-style commands and Git functionality.
✅ How to Open Git Terminal
Windows:
- Install Git for Windows.
- After installation, search for “Git Bash” in the Start Menu.
- Click to open the terminal.
macOS/Linux:
You can use the built-in Terminal after installing Git.
To check if Git is installed:
git --version
📂 Basic Git Terminal Commands
1. Navigate to a Folder
cd path/to/your/folder
Example:
cd Documents/my-project
Use ls
to list files in the current directory.
2. Initialize a Repository
Create a new Git repository in the current folder:
git init
3. Clone an Existing Repository
Download a project from GitHub:
git clone https://github.com/username/repo-name.git
4. Check Repository Status
See which files have changed:
git status
5. Add Files to Staging
Add all changes:
git add .
Add a specific file:
git add filename.txt
6. Commit Changes
Save changes with a message:
git commit -m "Your commit message"
7. Check Current Branch
git branch
8. Create a New Branch
git checkout -b new-branch-name
9. Switch Between Branches
git checkout branch-name
10. Push Changes to Remote Repository
git push origin branch-name
🧠 Tips for Using Git Terminal
- Use the Tab key to auto-complete file and folder names.
- Use ↑ (up arrow) to repeat previous commands.
- Run
git help
orgit help <command>
to get help on any Git command. - Combine commands for faster workflow:
git add . && git commit -m "Update" && git push
🏁 Conclusion
The Git Terminal gives you full control over your code and project history. With just a handful of commands, you can manage code versions, collaborate with others, and streamline your development workflow.