Additionally you can remove all extra branches that you might have created during migration process.Īlternatively, if you are looking to save all your actions in history, check a correct answer here. git status On branch master Your branch is.
a branch into master git checkout master git mergeThen go back to Settings > Default Branch and switch default branch back to master. git commit -am 'Add crypto library' add-crypto 4445836 Add crypto library 2 files changed, 4 insertions(+) create mode 160000 CryptoLibrary git checkout master warning: unable to rmdir CryptoLibrary: Directory not empty Switched to branch 'master' Your branch is up-to-date with 'origin/master'. Commit staged changes with git commit -m commit message Create tags (for. First, we need to change to the master branch: Example. Git push origin legacy # push our legacy branch too We have the emergency fix ready, and so lets merge the master and emergency-fix branches. git merge dev Updating 03c769c.b0147e6 Fast-forward index. Git push origin master # push out our new master branch Once you are in the master branch, execute git merge dev as shown below to merge the dev branch with master. Once you do this, you can proceed: git push origin :master # remove master on GitHub This can be done in repository Settings > Default Branch. The git branch command allows you to create, list, rename and delete branches. We can perform various operations on Git branches. It can be called as an official working version of your project. For example: git checkout feature git checkout -b feature. Master branch is the branch in which all the changes eventually get merged back. One simple habit to adopt to address this situation (when you want to share a rebased branch) is to create a second branch with a derivative name (feature.2, for example) that starts pointing to the same commit as feature, then rebasing and pushing feature.2. You need to take another branch as default first. A repository can have only one master branch.
However you cannot simply remove master branch on GitHub. Go to repo settings tab and choose branches from left side pane. Git branch -m another_branch master # another_branch will be our new master Step 3 Swap default branch setting in Github UI Now we have to swap the default branch from master to main, so we can permanently delete the old branch name, to avoid any future confusions Follow the steps below to swap the default branch name in GitHub SCM. Here are actual commands that you might need to execute to achieve the goal locally and on GitHub: git branch -m master legacy # rename local master to legacy
Since the task was to simply use another branch instead of master, you can simply remove master branch completely or rename it to let's say - legacy, then take another branch and rename it to master.