I think you are going about this wrong. Create a pull request on GitHub to 'pull' your changes from test into main, 'review' the request and approve it. OR you can simply merge your changes in test to main. Doing the merge with a pull request documents the merge and is normally the correct way to do a merge in a multi-user repository. Even if this is just your own repo now, good practices are a good thing. IMO you do NOT want to make another branch the 'master', it would just confuse things. Answer from bdzer0 on reddit.com
🌐
Reddit
reddit.com › r/github › how to completely replace the main branch with the content of a development branch?
r/github on Reddit: How to completely replace the main branch with the content of a development branch?
March 17, 2024 -

Let's suppose that for the past few weeks, I've been working on a program directly from its master branch (committing to it locally, pushing it to Github).

Now, let's suppose I want to make some fairly radical changes that involve wholesale deletion and rewrites. I think what I want to do is something like git checkout -b radicalrewrite to create a new branch named "radicalrewrite" and make it current.

Now, let's suppose it's a few weeks from now, and I want the "radicalrewrite" branch to become the "new normal". I don't want to merge it into master, I want the changes in the "radicalrewrite" branch to completely replace everything in the original master branch... deleting files from master that were deleted from the branch, completely replacing the remaining ones with their new versions from the branch, and adding any new files that are in the branch.

What's the correct sequence of actions to do this?

🌐
iorad
iorad.com › player › 2117179 › GitHub---How-to-change-default-branch-to-main-on-GitHub-desktop-
GitHub - How to change default branch to main on GitHub desktop.
Here is how to do it. Open up GitHub Desktop.. Click File.. Click Options.. Click Git.. Click main.. Click Save.. That's it. You're done.
🌐
Stevenmortimer
stevenmortimer.com › 5-steps-to-change-github-default-branch-from-master-to-main
5 steps to change GitHub default branch from master to main | Steven M. Mortimer
From there, click "Settings" -> "Branches" on the left rail and change the default branch to ‘main’. I’ve included some screenshots below and GitHub provides instructions for doing this here: https://docs.github.com/en/github/administering-a-repository/setting-the-default-branch. Now that the local ‘master’ is gone and there’s nothing pointing to it on Github you can delete it with the following command:
🌐
Reddit
reddit.com › r/github › how do i make a branch the master?
r/github on Reddit: How do I make a branch the master?
November 27, 2023 -

Hi all,

Apologies for the noobie nature of this question but I really am in the dark when it comes to Git other than making commits. Here's what I'd like to learn...

In my repo I have the main branch and when I wanted to experiment a bit a friend showed me how to create a new branch (called test) which wouldn't affect my working code if it went wrong and I could just go back to 'main'. The experiment worked okay and I'd now like that branch to be the main (if that makes sense- I think it does in my head!). I'm using Github Desktop on macOS if that makes a difference.
Any help at all would be most gratefully appreciated.

🌐
GitHub
gist.github.com › jonlabelle › 81206faafb56714d7499efa54eb8f3ff
Change GitHub default branch from master to main. · GitHub
From the left rail, click Settings -> Branches and change the default branch to main ... After you rename a branch in a repository on GitHub, any collaborator with a local clone of the repository will need to update the clone.
🌐
GitHub
gist.github.com › zrod › 4251777
"Replace" master with another branch · GitHub
Save zrod/4251777 to your computer and use it in GitHub Desktop. Download ZIP · "Replace" master with another branch · Raw · gistfile1.txt · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below.
🌐
GitHub
gist.github.com › 38befcde0ce38f82217c44d16971acbb
Overwrite master with another branch · GitHub - Gist
Overwrite master with another branch. GitHub Gist: instantly share code, notes, and snippets.
🌐
GitHub
gist.github.com › bultas › 3fcd11d8e5e31e93562d
GIT - how to replace master branch with another branch · GitHub
Save bultas/3fcd11d8e5e31e93562d to your computer and use it in GitHub Desktop. Download ZIP · GIT - how to replace master branch with another branch · Raw · gistfile1.sh · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below.
Find elsewhere
🌐
GitHub
gist.github.com › 0xdade › dbb18fb4a3866de18149efbb63277cab
Changing default branches on github · GitHub
... Change "Default Branch" in Settings->Branches on github. https:github.com/your/repo/settings/branches. Accept any warnings about changing the default branch. If you have any branch protection rules that affect the master branch, delete them.
🌐
GitHub
docs.github.com › en › desktop › making-changes-in-a-branch › managing-branches-in-github-desktop
Managing branches in GitHub Desktop - GitHub Docs
For more information, see Configuring basic settings in GitHub Desktop. In the repository bar, click Current Branch, then click the branch that you want to switch to. If you have saved, uncommitted changes, in the "Switch Branch" window, select ...
🌐
GitHub
github.com › desktop › desktop › issues › 11447
GitHub Desktop still defaults to creating a default branch titled master instead of main in some cases · Issue #11447 · desktop/desktop
January 23, 2021 - Once it is created, go to GitHub Desktop and File>Clone repository... ... Current branch is now set to master. You cannot rename master from here by going to Branch>Rename or by hitting Ctrl+Shift+R. This does not change if you create a file, ...
Author   desktop
🌐
GitHub
github.com › github › renaming
GitHub - github/renaming: Guidance for changing the default branch name for GitHub repositories · GitHub
September 12, 2023 - GitHub Desktop has introduced a default branch setting for new repositories. ... The default branch name for new repositories created on GitHub is now main.
Author   github
🌐
Medium
medium.com › @zandra.harner › github-branching-and-merging-using-github-desktop-ba4f7d59fdb9
GitHub Branching and Merging using GitHub Desktop | by Alexandra Z Harner | Medium
September 11, 2020 - Go back to GitHub Desktop, create a new branch. Click “Branch” at the top, click “New branch …” ... Name it as myFirstBranch in the “Create a branch” dialogue. ... Now you have two branches, the default “master” branch and ...
🌐
DEV Community
dev.to › tracycss › renaming-your-master-branch-to-main-in-github-24cm
Renaming your master branch to main in Github👩‍💻 - DEV Community
September 8, 2020 - You can also change the default branch in each repos individually (I will show you how to do it in step 2). Just create a new default branch and click the update button. For me, I went with the main branch.
🌐
GitHub
docs.github.com › en › repositories › configuring-branches-and-merges-in-your-repository › managing-branches-in-your-repository › changing-the-default-branch
Changing the default branch - GitHub Docs
For more information, see Allowing repository admins to rename branches with organization rulesets. Additionally, you need to have admin access to a repository to change the default branch. On GitHub, navigate to the main page of the repository.
🌐
DEV Community
dev.to › kristenkinnearohlmann › converting-a-git-master-branch-to-main-1c9h
Converting a Git master Branch to main - DEV Community
November 15, 2021 - Choose Settings > Branches; master will display as the default branch ... Acknowledge the warning for changing the default branch (ideally, you will communicate separately with others working in this repo that the default branch has changed)
🌐
GeeksforGeeks
geeksforgeeks.org › git › how-to-replace-master-branch-with-another-branch-in-git
How to Replace Master Branch with Another Branch in GIT? - GeeksforGeeks
June 4, 2024 - This guide will walk you through the steps to replace the "master" branch with the contents of another branch in Git.