Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

how to move master branch to main branch

# Step 1 
# create main branch locally, taking the history from master
git branch -m master main

# Step 2 
# push the new local main branch to the remote repo (GitHub) 
git push -u origin main

# Step 3
# switch the current HEAD to the main branch
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main

# Step 4
# change the default branch on GitHub to main
# https://docs.github.com/en/github/administering-a-repository/setting-the-default-branch

# Step 5
# delete the master branch on the remote
git push origin --delete master
Comment

git change master branch

## 1) Rename master branch to oldmaster.
git branch -m master oldmaster
#Now there is no master branch on my local machine.

## 2) Rename my masterTemp branch to master
git branch -m masterTemp master
#The branch which was named masterTemp on my local machine is now master

## 3) Delete the branch from remote
git branch -rD master

## 4) Push the new master branch to remote
git push --force origin master
Comment

git move change from master to new branch

git stash						//you can stash the changes in the master branch .
git checkout -b newbranchname	//then checkout the branch
git stash pop					//and pop the changes here
Comment

how to move master changes to branch

git checkout -b newfeat master
git rebase --onto working-branch origin/master newfeat
git checkout master
git reset --hard origin/master

At this point you have:
*master pointing to the last pushed commit (origin/master)
*working-branch never changed
*a new newfeat branch that contains all the new commits and is ahead of working-branch.

Comment

Move you changes to your new branch from master

make your changes on master
creat new branch  my_branck and checkout the new branch
git add .
git commit 
git push
git checkout my_branch
git checkout master
to make sure your master is clear `git clewan -f`
Comment

PREVIOUS NEXT
Code Example
Shell :: how to compile 64 bit nasm 
Shell :: kill process using cmd 
Shell :: brew check installed packages version 
Shell :: pip remove package 
Shell :: git change date 
Shell :: git delete all local branches starting with 
Shell :: how to install cuda on ubuntu 20.04 
Shell :: bash echo 
Shell :: bash adding floats 
Shell :: limits.h: No such file or directory 
Shell :: cant find module firebase 
Shell :: command to variable bash 
Shell :: install automapper asp.net core mvc 
Shell :: screenshot to clipboard ubuntu 20 
Shell :: git revert merge commit 
Shell :: cache github credentials ubuntu 
Shell :: modify a host file mac 
Shell :: watch tail file linux 
Shell :: git installing in linux 
Shell :: Package signatures do not match previously installed version; ignoring! 
Shell :: install spacemacs 
Shell :: use file connect ssh 
Shell :: git push local repo to remote 
Shell :: how to navigate to a folder in cmd windows 10 
Shell :: Wine Mono is not installed 
Shell :: installing haskell command 
Shell :: install old firefox version ubuntu 
Shell :: svelte typescript 
Shell :: sudo apt-get install jpeg 
Shell :: docker build from github repository 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =