Dec 02, 2025
Ariffud M. & Aris S.
5min Read
Git commands let you interact with the version control system to manage repositories and track changes. You can use them to create, modify, and sync repositories between your local development environment and remote codebases, streamlining your workflow.
The most basic Git commands let you initialize a new repository, stage changes for commits, and check the status of modifications. Additional commands help you manage branches, merge code, and tag specific versions for easy identification.
Git also provides commands for interacting with remote repositories, allowing you to clone codebases or connect to platforms like GitHub. Advanced commands, such as blame and bisect, help with specific tasks like debugging and tracking down issues in your code history.
Start by exploring the basic Git commands for essential tasks, then move on to commands for managing branches, remote repositories, and advanced features.
Basic Git commands are used to create, manage, and track changes within a repository. These commands form the foundation of version control, helping you record your project’s history and making them essential when learning about Git. They include:
git init [name]
git add <filename>
git commit -m "your commit message"
git status
git log
git diff [file-branch-directory-or-commit] [file-branch-directory-or-commit]
git rm <filename>
git mv <filename> <filename-or-directory>
git config --global user.email "your.email@example.com"
While commands offer flexibility and efficiency, some users prefer using a graphical user interface (GUI) to visualize how version control works. In this case, consider using one of the best Git GUI clients.
“Branching and merging commands let you work on different features or fixes simultaneously. They make it easy to integrate changes and maintain a clean, organized project history.
git branch [--options] [branch-name]
git checkout branch_name
git merge branch_name
git cherry-pick commit_hash
git rebase main
git tag v1.0
Remote commands connect your local repository to external ones like GitHub or GitLab. They allow you to share your work, collaborate with others, and synchronize changes between environments.
git clone https://github.com/username/my-project.git
git push origin main
git pull origin master
git fetch origin
git remote [options] [subcommand] [args]
git submodule add https://github.com/username/submodule-repo.git submodule/path/on/main-repo
Advanced commands offer greater control over your repository’s history and workflow. They’re used for tasks like rewriting commits, troubleshooting issues, and optimizing project structure.
git reset <filename>
list to view stored changes and pop to reapply them to your working directory:git stash [subcommand]
git bisect start
git blame file1.txt
git reflog
-n option first to preview what will be deleted, then confirm with the -f option:git clean [options]
If you’re just starting out, remembering Git commands can be challenging. To help you master this tool, we’ve created a Git cheat sheet you can download or print out. Keep it handy whenever you need a quick reference for Git commands.
The simplest way to install Git on Ubuntu is using the apt package manager. This works for any Ubuntu version and automatically installs a stable version of Git.
If you need a specific version of Git, you can build it from source by downloading the installation package from its GitHub repository. However, this method is more complicated.
Regardless of the installation method, you’ll need to configure Git with your user information and connect to your remote repository account, such as GitHub or GitLab.
Both methods work on all Ubuntu systems, whether desktop or server versions. If you’re using a hosting provider, they may offer one-click installation or other tools that simplify the process.
If you use the Hostinger VPS solution, you can ask our AI assistant Kodee to provide the Git installation commands. Simply open hPanel and type, “Give me the commands for installing Git and connecting my GitHub account.”

Then, connect to your Hostinger server using PuTTY or our Browser terminal and run the provided commands. If you use other Hostinger web hosting plans, you can also connect your repository to your website via hPanel for easy deployment.

After understanding the essential Git commands, the next step is to practice by managing personal projects. This is the best way to get comfortable with these tools before working on real-world repositories at scale.
Mastering Git commands becomes crucial when managing large-scale projects with many contributors. Versioning commits, branches, and repositories lets you track changes effectively, identify issues quickly, and revert problematic changes as needed. The result is a more streamlined development process.
For example, some of the most popular and best GitHub repositories have thousands of contributors pushing changes daily. Check them out to see how large-scale projects use Git commands effectively in practice.
Comments
September 12 2019
very helpful,tks
January 22 2022
Hello, the download file is no longer available, can you please fix the link? Thank you!
January 25 2022
Hi Rob, thanks for pointing that out - the link was fixed now :)
September 11 2022
I'm not a developer, but it seems as though this system may be useful for keeping track of unwanted changes to ones laptop or phone files. Or am I just missing a more mainstream way of doing so? I have SO many problems with my hardware being "hacked" and or taken over! Any help very appreciated!
September 16 2022
Hey there! You can track changes with Git, and you can check articles like this one to learn how to do it! ?