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»GIT»How To Clone Specific Git Branch

    How To Clone Specific Git Branch

    RahulBy RahulMarch 23, 20191 Min ReadUpdated:July 15, 2021

    Git is commonly used as a version control system for any application. Which is helpful for tracking changes in any set of source files. A branch in Git represents an independent line of development with a unique set of code changes with a unique name.

    This tutorial will help you to clone a specific branch from the remote Git repository.

    Clone Specific Git Repository

    You can clone any remote repository with git clone command. The default clones the master (main) branch from remote. You can also specify the branch name with -b option to clone a specific branch.

    git clone -b 5.8-branch https://github.com/WordPress/WordPress.git 
    

    The above command clones the specific branch but fetches the metadata of other branches. You can view all branches details with command git branch -a.

    To skip metadata of other branches use --single-branch option like:

    git clone -b 5.8-branch --single-branch https://github.com/WordPress/WordPress.git 
    

    That’s it. Switch to the newly created directory and type git branch to check the branch.

    Conclusion

    In this write-up, you have learned to clone a specific Git branch from a remote repository like Github, Gitlab, Bitbucket, or a self-hosted Git server.

    git git branch
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow To Install Laravel on Debian 10
    Next Article How To Install Slack on Ubuntu 18.04

    Related Posts

    How To Add a Git Remote Repository

    3 Mins Read

    How to Git Reset to Head

    Updated:November 3, 20213 Mins Read

    How to Delete a File on Git

    3 Mins Read

    How to Git Stash Changes

    Updated:October 29, 20213 Mins Read

    How to delete Git tags

    Updated:October 25, 20211 Min Read

    How to Create Git tags

    Updated:October 25, 20212 Mins Read

    1 Comment

    1. Iron ThundeR on June 15, 2019 10:45 pm

      What’s up friends, pleasant paragraph and pleasant urging commented
      at this place, I am really enjoying by these.

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install Sublime Text 4 on Ubuntu 22.04
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.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.