Skip to content

Instantly share code, notes, and snippets.

@gcziprusz
Created November 22, 2024 15:43
Show Gist options
  • Save gcziprusz/1361e3084a81aa9490193e95571da836 to your computer and use it in GitHub Desktop.
Save gcziprusz/1361e3084a81aa9490193e95571da836 to your computer and use it in GitHub Desktop.

1. Clone Your Personal Repo

If you haven’t already, clone the personal repo to your local machine:

git clone https://github.com/yourusername/your-personal-repo.git
cd your-personal-repo

2. Add the Organization Repo as a Remote

Find the URL of the organization repo where you want to push the code. Add it as a new remote:

git remote add org-origin https://github.com/organization-name/organization-repo.git

You can verify the remotes using:

git remote -v

3. Push Your Work to the Organization Repo

Push the code from your local machine to the organization repo:

git push org-origin main

Replace main with your branch name if it's different.


4. Clean Up (Optional)

Once you've successfully pushed the code to the organization repo:

  • Remove the remote for the personal repo (optional):

    git remote remove origin

    This prevents accidental pushes to your personal repo.

  • Delete the personal repo from GitHub:
    If you no longer need the personal repo, you can delete it from GitHub.


5. Confirm the Push

Go to the organization repo on GitHub and verify that all your code has been successfully pushed.

Let me know if you encounter any issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment