Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7627421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:27:27+00:00 2026-05-31T05:27:27+00:00

I have forked a repository, then I made some changes and it looks like

  • 0

I have forked a repository, then I made some changes and it looks like I’ve messed up everything.

I wish to start it again from scratch, using the current upstream/master as the base for my work.
Should I rebase my repository or delete it at all?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:27:27+00:00Added an answer on May 31, 2026 at 5:27 am

    The simplest solution would be (using ‘upstream‘ as the remote name referencing the original repo forked):

    git remote add upstream /url/to/original/repo
    git fetch upstream
    git checkout master
    git reset --hard upstream/master  
    git push origin master --force 
    

    (Similar to this GitHub page, section “What should I do if I’m in a bad situation?”)

    Be aware that you can lose changes done on the master branch (both locally, because of the reset --hard, and on the remote side, because of the push --force).

    An alternative would be, if you want to preserve your commits on master, to replay those commits on top of the current upstream/master.
    Replace the reset part by a git rebase upstream/master. You will then still need to force push.
    See also “What should I do if I’m in a bad situation?“


    A more complete solution, backing up your current work (just in case) is detailed in “Cleanup git master branch and move some commit to new branch“.

    See also “Pull new updates from original GitHub repository into forked GitHub repository” for illustrating what “upstream” is.

    upstream


    Note: recent GitHub repos do protect the master branch against push --force.
    So you will have to un-protect master first (see picture below), and then re-protect it after force-pushing).

    enter image description here


    Note: on GitHub specifically, there is now (February 2019) a shortcut to delete forked repos for pull requests that have been merged upstream.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a repo that's forked from a remote repository. I made some changes,
I have forked a git repository and setup upstream. I've made some changes in
I forked someone elses repository on Bitbucket and made some changes (and pushed them
I have a project I forked on github to my repository. I made changes
I have forked a repository on github some time ago, made a small change
I'm using NHibernate 3.2 and I have a repository method that looks like: public
I have forked the git repository of a project on Github and made my
I have a repository on github, and someone else has forked it and made
I have forked a branch from a repository in GitHub and committed something specific
I have a forked github repository (call it repo-O and call my fork repo-F)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.