Skip navigation

Push to your remote

Instructions to configure remote repositories, push local changes, and keep your project updated with the latest features and bug fixes from the base repository.

Overview

If you're visiting this page, you likely already have a robust test suite for your project. Now it’s time to push your code from your local machine to the remote repository so your team can collaborate effectively.

This guide assumes your remote repository URL is https://github.com/precise-alloy/your-repo.git. Be sure to replace this placeholder URL with the actual URL of your repository.

Repository URLs:

  • Base repo URL: https://github.com/precise-alloy/regression-test.git
  • Your project repo URL: https://github.com/precise-alloy/your-repo.git

Steps

Step 1: Update the Remote Origin URL

Set your remote origin to point to your project repository:

# Update the origin URL to your project repository
git remote set-url origin https://github.com/precise-alloy/your-repo.git

After this, all git pull and git push commands will target your project repository by default.

Step 2: Commit Your Changes

If you’ve made changes locally, commit them as follows:

# Stage all files for commit
git add .

# Commit with a descriptive message
git commit -m "Your commit message"

Step 3: Push to Your Remote Repository

Push your changes to the remote repository:

# Push to the remote repository
git push

Step 4: Add the Base Repository as a Second Remote

Add the base repository as an additional remote for fetching updates:

# Add the base repository as another remote
git remote add hn https://github.com/precise-alloy/regression-test.git

Verify Remotes

Run the git remote -v command to confirm you have two remotes:

git remote -v

hn      https://github.com/precise-alloy/regression-test.git (fetch)
hn      https://github.com/precise-alloy/regression-test.git (push)
origin  https://github.com/precise-alloy/your-repo.git (fetch)
origin  https://github.com/precise-alloy/your-repo.git (push)

Please double-check that the origin points to your project's repository.

Step 5: Fetch and Merge Updates from the Base Repository

Pull the latest updates from the base repository into your local repository:

# Fetch and merge updates from the base repository
git fetch hn
git merge hn/master

If the commands run successfully, you’ll have the latest features and bug fixes from the base repository. You can now test the changes locally and push them to your project repository:

# Push the changes to your project repository
git push

Periodically fetch, merge, and push updates from the base repository to ensure your project benefits from the latest features and bug fixes.