How to create and push new git branch without history of master/other branch

 

Hi,

Everyone,

Here, We are going to see how to create a new branch without existing git source code. For that we need to use this (--orphan) keyword in git

Create an orphan branch, It does not have a master branch source, it's like an empty branch, So, we can push our new source in this branch

git checkout --orphan <name_of_the_orphan_branch>
git commit


Then you can push your new source in the orphan branch


git push <remote-name> <orphan_branch-name>


Thank you,
Happy coding😊...

Comments

Popular posts from this blog

Your build is currently configured to use incompatible Java 21.0.3 and Gradle 8.2.1. Cannot sync the project.

SonarQube With Angular 19 on Windows: A Complete Setup and Integration Guide

Error in Android Migration Gradle 7.5 to 8.5 - java.lang.NullPointerException: Cannot invoke "String.length()" because "" is null