After you connect to a remote Git repository, you can use Postman to make changes to your API and collaborate with others. Any changes you make to your API's definition or collections always happen on a branch. You can work on any branch in your repository.
If you configured a remote repository, Postman stores your changes in a local cache. When you're ready to share your work with others, push your changes to the remote repository.
Git branches help you organize your work and collaborate with others. As an API producer, you always work on a branch.
If your Git repository has multiple branches (such as main
, develop
, and feature branches) you can switch between branches in Postman. Switching to a branch makes it the active branch.
To switch branches, select the Git branch dropdown menu in the Postman footer, then select the branch you want to make active. After switching to a branch, you can use Postman to make changes to your API's definition and collections. Any changes you make are stored in the active branch.
The Git branch dropdown menu shows both remote branches and local branches. Remote branches exist in the repository but not locally in Postman. When you switch to a remote branch, Postman pulls the branch to your local system.
Postman displays a limited set of branches in the list. If a branch isn't listed, enter a branch name in the Search box of the dropdown and select the branch to switch to it.
Feature branches enable you to work on changes to your API without affecting the default branch in your repository. When you create a new branch, Postman automatically makes it the active branch.
To create a new branch in the remote repository, do the following:
To delete a local branch, select the Git branch dropdown menu in the Postman footer, then select the delete icon next to the local branch. Deleting a local branch removes the branch from your local system but doesn't remove the branch from the remote repository. If you delete the active branch, Postman automatically switches to another branch.
If there are changes on the local branch you want to keep, make sure to commit and push them before deleting the branch. You can't recover a local branch after deleting it, but you can switch to the associated remote branch to pull it to your local system again.
Deleting a remote branch from the repository doesn't remove the associated local branch in Postman. You can delete any local branches that are no longer needed.
As you work on your API, Postman tracks the changes you make to the active branch. Use the Source Control pane to view and manage your change history. You can commit and push your changes to the remote repository to make your work available to others. You can also pull changes to keep your working files up to date with the remote repository.
To show or hide the commit history, select Commits. Expand a commit to see details about the changes. When viewing file diffs, you can use the dropdown menu next to Commits to show file history or show all commits.
The Source Control pane displays the number of changes in the active branch in Postman.
To commit and push the changes to the remote repository, do the following:
Select APIs in the sidebar and select an API.
Select the source control icon in the right sidebar.
If you want to review the changes before committing and pushing them, hover over a file and select the diff icon .
You can discard changes in a file by selecting the discard icon next to it.
To commit the saved changes to the active branch, enter a commit message and select Commit and Push.
You can also commit the changes to a new feature branch instead of the active branch. Select Create a new branch to commit and push and enter a new branch name before committing.
If there are changes in the remote repository, you need to pull the changes before you can commit and push.
After you push a change, other producers on your team can switch to the branch, pull the changes, and view the updates you made.
Pulling brings changes from the remote (origin) branch into your active branch.
To pull changes from the remote branch, do the following:
If there are any conflicts, you'll need to resolve the conflicts before you can finish pulling the changes.
If a change in your active branch conflicts with a change in the remote (origin) branch, you must resolve the conflict before you can pull changes.
To resolve a conflict, do the following:
If the file with the conflict isn't in a format Postman supports, you'll need to resolve the conflict in your preferred Git client.
After you push changes to a branch, you can create a pull request (PR) to merge your changes into another branch. For example, if you are working on a feature branch, you can create a pull request to merge your changes into the repository's main branch.
To create a pull request, do the following:
After the PR is merged, make sure to switch to the branch you merged the changes into and pull the changes.
Any branches and changes you push to your remote repository are visible to other API producers on your team. You can also create a pull request to ask others on your team to review your changes.
To make your changes available to your API's consumers, publish a new version of your API. When you publish a version, the API's definition and collections are synced to your workspace in the Postman cloud. Consumers can view the version in your workspace. You can also choose to add the version to your Private API Network. Learn more about publishing an API version.
Last modified: 2023/09/15
Additional resources
Videos
Blog posts