-1

We have a parallel development branch (dev) that we only use during code freeze. We have not touched it for many months, and now there's a need to re-use that branch again. The status of that branch is 279 commits behind, 59 commits ahead, I have no idea how it got that ahead commits.

Now I want this dev branch to have the exact same codebase as the origin/main, I honestly do not care whatever's inside this branch, I just want it to be exact same copy as origin/main.

I go into the dev branch, pull from main, and I have hundreds of conflicts. I have tried for hours, and it still isn't perfect.

I thought of just creating a new branch off main, but do not have enough permissions in our repository to set up the branch policies. The people that is responsible for that is out of office for the next few weeks.

Is there any way:

  • For me to make this dev branch an exact copy of the origin/main?
  • Or, for when I'm pulling from origin/main, to TAKE EVERYTHING from main and IGNORE EVERYTHING in this dev branch?
1
  • You should go on the dev branch and is used command: git merge main Commented Sep 4, 2023 at 9:37

1 Answer 1

3

From the dev branch, you can use:

$ git fetch origin/main $ git reset --hard origin/main 

this will set the branch HEAD to the latest commit on the remote. As you are rewriting the history of the branch, you will need to force push the branch (-f) next time you push to the remote branch.

Sign up to request clarification or add additional context in comments.

1 Comment

@TorgeRosendahl I know what it does, it just didn't seem required here

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.