Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»General Articles»How to Create Empty Branch in Git Repository

    How to Create Empty Branch in Git Repository

    RahulBy RahulJune 4, 20221 Min Read

    I have an application code maintained in the Github repository. Now our requirement is to create the documentation for that application and save them under a separate branch in the same repository. I simply tried to create a new branch but it linked to the main branch. After googling it, I found an option --orphan to create branch with no parents.

    This tutorial will help you to create a new empty branch in the Git repository.

    Git Create Empty Branch

    We can use --orphan command line option to create a new branch with no parents.

    git checkout --orphan new-empty-branch 
    

    The above command will create a new branch with no parents. Now, you can delete files from the working directory, so they don’t commit to a new branch.

    git rm -rf . 
    

    Now, you can add new files to this new branch, commit and push them up to the remote git repository.

    branch git
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleCreating Python Virtual Environment on Windows
    Next Article How to Install Apache Kafka on Ubuntu 22.04

    Related Posts

    How to Install Ionic Framework on Ubuntu 22.04

    3 Mins Read

    What is the /etc/hosts file in Linux

    Updated:June 27, 20222 Mins Read

    Creating DMARC Record for Your Domain

    Updated:June 29, 20223 Mins Read

    What is Computer Hardware?

    4 Mins Read

    What is Information Technology (IT)?

    Updated:June 29, 20223 Mins Read

    How to Recycle IIS Application Pool in Windows

    Updated:June 16, 20222 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • What is the /etc/aliases file
    • What is the /etc/nsswitch.conf file in Linux
    • How to Install Ionic Framework on Ubuntu 22.04
    • What is the /etc/hosts file in Linux
    • How to Install Angular CLI on Ubuntu 22.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.