Terra
Integrations
Research

Integration

API
Unified API
SDK
SDK
Authentication
Authentication
Streaming
Streaming
Blood
Blood Report API
Planned Workouts
Planned Workouts
AI Interface
AI Interface

User engagement

Graph API
Graph API
Scores
Health Scores
Rewards
Health Rewards

Use cases

Enterprise
Enterprise
Insurance
Insurance

Developers

Wearable Data
Wearable Data
Community
Community
Documentation
Documentation

Learn

Blog
Blog
Podcast
Podcast
Events
Events
Reports
Reports

Company

Customers
Customers
Careers
Careers
Partners
Partners
Support
Support
Pricing
Become an integrationGet started
IntegrationsResearch
Unified APIUnified APISDKSDKAuthenticationAuthenticationStreamingStreamingGraph APIGraph APIScoresScoresRewardsRewardsBlood Report APIBloodAI InterfaceAI Interface
EnterpriseEnterpriseInsuranceInsuranceWearable DataWearable DataCommunityCommunityDocumentationDocumentationBlogBlogPodcastPodcastEventsEventsReportsReportsCustomersCustomersCareersCareersPartnersPartnersSupportSupport
Pricing
Get startedBecome an integration
next ventures
pioneer fund
samsung next
y combinator
general catalyst

The world's best health apps run on Terra data

Get started
ProductsIntegrations AI Interface Authentication Mobile Development Documentation GraphAPI
DocumentationAPI SDK Quickstart
CommunityBlog Research Community Podcast Github
CompanyAboutCareersCustomersBecome an IntegrationCookies PolicyGDPRPrivacy PolicyTerms of Purchase
© Terra API. 2026 — All rights reserved.

Cookie Preferences

Essential CookiesAlways On
Advertisement Cookies
Analytics Cookies

Crunch Time: Embrace the Cookie Monster Within!

We use cookies to enhance your browsing experience and analyse our traffic. By clicking “Accept All”, you consent to our use of cookies according to our Cookie Policy. You can change your mind any time by visiting out cookie policy.

Cookies Policy
< Blogs
Hanbo
Hanbo

May 1, 2023

Introduction to Git Controls

Git is a powerful version control system that allows developers to efficiently manage changes to their code. Whether you're working on a small personal project or contributing to a large collaborative project, understanding the basics of Git is essential. In this article, we'll cover some of the basic Git controls that every developer should know.

In this series of articles, we'll explore the world of Git controls from the command line interface, starting with the basics and working our way up to more advanced commands. Whether you're a seasoned developer or just getting started, understanding Git controls is essential for managing your code effectively. So, let's dive in and learn how to make the most of Git!

What is Git?

Git is a distributed version control system that was created by Linus Torvalds in 2005. It is designed to handle everything from small to very large projects with speed and efficiency. Git allows developers to work collaboratively on the same codebase without worrying about conflicts or overwriting each other's changes.

Git tracks changes to your code over time and allows you to easily roll back to a previous version if something goes wrong. It also provides tools for branching and merging, allowing you to experiment with new features or fix bugs without affecting the main codebase.

Basic Git controls

Here are some of the most basic Git controls that every developer should know:

Probably the most important Git Command

One of the most important Git controls you'll use is git status. This command tells you the current status of your working directory, including which files have been modified and which changes have been staged for commit.

>>> git status
On branch develop
Your branch is up to date with 'origin/develop'.

nothing to commit, working tree clean

This will show you the current status of your working directory, including which branch you're on, any changes that have been made, and which files have been staged for commit.

If you've made changes to your code that you want to commit, you'll need to stage those changes using the git add command (see the sections below). Once you've added your changes, you can use git status again to see which files have been staged:

This will show you which files have been staged and which changes are still waiting to be committed.

By regularly using git status, you can keep track of your changes and ensure that your code is always in a clean and stable state. It's a simple yet powerful tool that every developer should have in their Git toolkit.

Clone a repository

The first step in working with Git is to clone a repository. Cloning creates a local copy of the remote repository on your computer that you can work on.

To clone a repository, use the git clone command followed by the URL of the remote repository:

git clone https://github.com/username/repository.git

Stage changes

Once you have made changes to your code, you need to stage them before committing. Staging means that you are selecting which changes you want to include in the next commit.

To stage changes, use the git add command followed by the file or files you want to stage:

git add file1.txt file2.txt

You can also stage all changes at once using:

git add .

Commit changes

Once you have staged your changes, you can commit them to the repository. A commit is a snapshot of your code at a specific point in time.

To commit changes, use the git commit command followed by a commit message that describes the changes you made:

git commit -m "feat(parser): add ability to parse arrays"

Note that it would be very helpful if your commit messages follow the standard git commit message convention.

Push changes

Once you have committed your changes, you need to push them to the remote repository so that other developers can access them.

To push changes, use the git push command followed by the name of the remote repository and the branch you want to push to:

git push origin main

When you push your changes to a remote repository using the git push command, Git will automatically merge your changes with the existing code on the remote repository. However, in some cases, you may need to force push your changes using git push -f (or --force flag) to overwrite the existing code on the remote repository.

It's important to use git push -f with caution, as it can potentially cause conflicts and data loss if other developers have made changes to the remote repository since your last push. You should always communicate with your team members before force pushing your changes, and make sure that everyone is on the same page to avoid conflicts.

If you do need to force push your changes, you can use the following command:

git push -f  

This will overwrite the code on the remote repository with your changes, potentially losing any changes that were made by other developers in the meantime.

In general, it's best to avoid force pushing your changes unless it's absolutely necessary. Instead, you can use other Git controls like git rebase or git merge to merge your changes with the existing code on the remote repository in a more controlled way.

Pull changes

If other developers have made changes to the code since you last pulled, you will need to pull those changes before you can push your own changes.

To pull changes, use the git pull command:

git pull

Using git pull --rebase instead of git pull will apply your local changes on top of the updated code, resulting in a cleaner commit history. This command essentially rewinds your local repository to the point where it diverged from the remote repository, applies the changes from the remote repository, and then applies your local changes on top.

To use git pull --rebase, simply type the following command in your terminal:

git pull --rebase

This will fetch the changes from the remote repository and apply them to your local repository, then apply your local changes on top.

Create a branch

Branching allows you to work on new features or bug fixes without affecting the main codebase.

To create a new branch, use the git branch command followed by the name of the new branch:

git branch new-feature

To switch to the new branch, use the git checkout command followed by the name of the branch:

git checkout new-feature

To list all the branches, you can use the following command:

git branch -a

You can then press ‘q' and enter to exit the command.

Merge branches

Once you have finished working on a new feature or bug fix, you can merge your changes back into the main codebase.

To merge a branch, switch to the branch you want to merge into and use the git merge command followed by the name of the branch you want to merge:

git checkout main
git merge new-feature

Conclusion

To wrap up this article, we've explored the basics of Git controls from the command line interface, which will serve as a solid foundation for managing your code using Git. By mastering these controls, you'll be able to effectively track changes to your code, collaborate with other developers, and manage your repositories more efficiently. In the upcoming articles, we'll dive into more advanced Git techniques and examples to help you take your Git skills to the next level. So stay tuned for more!

Related Articles

The complete guide: How the new Google Health API works

May 18, 2026

The complete guide: How the new Google Health API works

Google Health API replaces the Fitbit Web API. This is the field guide with code, schemas, and a migration playbook to help you understand where Google Health is heading.

Vanessa Neeff
5 Lessons for Standing Out at HLTH

December 5, 2024

5 Lessons for Standing Out at HLTH

5 lessons from team Terra API for making a lasting impact at HLTH: from engaging senses to building real touch points, here’s what we learned from the HLTH event.

Vanessa Neeff
Strava Pulls the Plug on their API: What This Means for Developers

November 21, 2024

Strava Pulls the Plug on their API: What This Means for Developers

Strava discontinued their API service, changing the ecosystem of third-party apps that have relied on their platform. How can developers react to this?

Terra APITerra API

More Topics

All Blogs
Team Spotlight
Startup Spotlight
How To
Blog
Podcast
Product Updates
Wearables
See All >
The complete guide: How the new Google Health API works

The complete guide: How the new Google Health API works

Google Health API replaces the Fitbit Web API. This is the field guide with code, schemas, and a migration playbook to help you understand where Google Health is heading.

Vanessa NeeffVanessa Neeff
May 18, 2026
September 2025 updates

September 2025 updates

July: Terra Research launches, Lab Reports land in the dashboard with PDF/Image → JSON, and Samsung Health moves to the new Data SDK for a tighter Android integration. 🚀

Alex VenetidisAlex Venetidis
October 1, 2025
August 2025 updates

August 2025 updates

🎉 July Highlights: InBody Goes Global, Faster APIs, and Rock-Solid Data 💪📊

Alex VenetidisAlex Venetidis
September 1, 2025
July 2025 updates

July 2025 updates

July = rock-solid Terra: WHOOP V2, Garmin & Fitbit bug fixes, faster SDKs, plus bulk blood-report uploads with smarter reference ranges. Reliability + data power-ups! 💪🩸

Alex VenetidisAlex Venetidis
August 2, 2025
June 2025 Updates

June 2025 Updates

June brings Terra MCPs for AI-driven setup, Fern-powered Python/JS SDKs with strong typing, and official Expo plugin support—build faster with less friction. 🚀🧰📱

Alex VenetidisAlex Venetidis
July 1, 2025