[Ubuntu/server use] Assign different folders to different branches of git (with copying of hidden files)

[Ubuntu/server use] Assign different folders to different branches of git (with copying of hidden files)

Git is a very useful code version management platform, but I always thought that I could only create an "entity" of a warehouse locally, because even if the clone has different branches, its file name is still the same. But later found that the local folder name of clone can be easily controlled by parameters:

git clone ***.git [folder name] --branch [branch name]

Use the above command to branch namepull the branch of the warehouse into folder namea folder named .

View and copy hidden files (folders)

Before discovering the above command, I just created a new folder with another name, cloned it in it, and finally copied the cloned content from the source folder. This involves how to copy the .gitsum as the control file, because the hidden file cannot be copied directly. First of all, you can view all files in the folder, including hidden files. As an example, it can be copied through the following process (assuming copying to the folder of the upper level).ignorecp -r
ls -al
.git

cd [source dir]
mv .git git
cp -r git ../
cd ../
mv git .git

.In fact, it is to unhide it by removing it first , and then turn it into a hidden file after copying.

references

Git clones the specified branch of the remote warehouse and renames the hidden files under the correct copy Ubuntu locally

Guess you like

Origin blog.csdn.net/weixin_41625823/article/details/121565793