Git clone command with branch name9/3/2023 ![]() ![]() If this were my repo I'd rename the sampleproject branch to something more descriptive. sampleproject (at the end) is the name of the directory in your local filesystem that the repo will be cloned into.īut this is a bad idea: don't confuse yourself by using the same name for different things.sampleproject.git is the remote repo that will be cloned.You can run this copy run and manipulate your code on your local machine without affecting the code. This is because cloning allows you to create a copy of your code independent of the main version. -branch sampleproject is the branch that will be checkout'd. The git clone command creates a copy of an existing repository to a working directory on your local computer.Note that the name sampleproject is repeated 3 times because: We just need to branch name along with the URL. More succintly, the git clone command does let you do this in a single line: git clone -branch sampleproject /sampleproject.git sampleproject So, how do we clone from the specific branch Well, this is quite simple. Git clone /sampleproject.git sampleproject # Clone the repo into the directory `~/repos/sampleproject` (which will default to checking out the 'master' or 'main' branch): Several subcommands are available to perform operations on the submodules. COMMANDS With no arguments, shows the status of existing submodules. For more information about submodules, see gitsubmodules 7. Why not clone the repo normally and then git checkout the branch you want? DESCRIPTION Inspects, updates and manages submodules. ![]() I don't think you should be doing that because it introduces too many moving parts into your environment. I tried to clone different branches in the same location The Clone command clones from a StarTeam view into a newly created directory, creates remote-tracking branches for each child view (branch) in the cloned repository (visible using git branch -r ), creates and checks out an initial branch that is forked from the main StarTeam view. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |