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 4, 2023

Introduction to Git Controls (2)

In our previous article, we covered some of the basic Git controls that every developer should know. In this article, we'll go a step further and explore some more advanced Git controls that can help you manage your code more effectively.

Rebase

Rebasing is a powerful Git command that allows you to rewrite the history of your repository. It allows you to take a series of commits from one branch and apply them to another branch as if they had been committed there all along.

To rebase a branch, first, switch to the branch you want to rebase and then use the git rebase command followed by the name of the branch you want to rebase onto:

git checkout feature-branch
git rebase main

This will take all the changes you made on the feature branch and apply them on top of the main branch.

Rebasing can be useful when you want to keep your commit history clean and linear. It can also help you avoid merge conflicts by integrating changes from multiple branches before they are merged.

However, rebasing can be dangerous if you are working on a public branch that other developers are also using. If you rewrite the history of a public branch, you may cause conflicts for other developers who are working on that branch.

Interactive rebase

Interactive rebase is a variation of the git rebase command that allows you to modify and reorder your commits before applying them to another branch.

To start an interactive rebase, use the git rebase command with the -i flag:

git rebase -i HEAD~3

This will open up an interactive window that shows all the commits you want to rebase. From here, you can reorder, edit, or delete commits as needed.

Interactive rebase can be useful for cleaning up your commit history or combining multiple commits into a single commit before pushing them to a remote branch.

Cherry-pick

Cherry-picking is a Git command that allows you to apply a single commit from one branch to another branch.

To cherry-pick a commit, first, switch to the branch you want to apply the commit to, and then use the git cherry-pick command followed by the hash of the commit you want to apply:

git checkout main
git cherry-pick 123456

This will apply the changes from the specified commit to the main branch.

Cherry-picking can be useful when you want to apply a bug fix or feature from one branch to another branch without merging the entire branch.

Revert

Revert is a Git command that allows you to undo a previous commit without removing it from your commit history. It creates a new commit that undoes the changes made by the previous commit.

To revert a commit, use the git revert command followed by the hash of the commit you want to revert:

git revert 123456

This will create a new commit that undoes the changes made by the previous commit.

Revert can be useful when you want to undo a change that has already been pushed to a remote branch without rewriting the history of the branch.

Stashing

Stashing is a Git command that allows you to save changes that you are working on temporarily. This can be useful when you need to switch branches or work on a different feature without committing your changes.

To stash your changes, use the git stash command:

git stash

This will save your changes to a temporary storage area.

Once you're ready to apply your changes, you can use the git stash apply command to retrieve your changes from the stash:

git stash apply

Sometimes, when you stash changes using git stash, you may want to apply only a specific part of the stash instead of all the changes. This can be useful when you have multiple changes in the stash, but only need to apply one or a few of them.

To apply a specific part of the stash, you can use the git stash apply command with the --index flag and the index number of the specific stash entry you want to apply. For example, if you want to apply the second entry in the stash, you can use the following command:

git stash apply --index stash@{1}

By using these commands, you can apply specific parts of your stashed changes, giving you more control over how you apply changes to your code.

You can use git stash list to show a list of all stashed changes:

>>> git stash list
stash@{0}: WIP on develop: a23re14 lexer changes
stash@{1}: WIP on develop: a23re14 lexer changes
stash@{2}: WIP on master: 56d87e parser changes

You can use the git stash pop command to retrieve your changes and remove them from the stash:

git stash pop

Stashing can be useful when you need to switch contexts quickly without losing your changes.

Conclusion

Git is a powerful version control system that provides a wide range of controls for managing your code. By understanding the more advanced Git controls outlined in this article, you can take your Git skills to the next level and manage your code more effectively. However, it's important to use these controls carefully and to communicate with other developers to avoid conflicts and other issues. With practice and experience, you'll be able to use Git to its full potential and take your development skills to new heights.

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