简体   繁体   中英

Clone a git repository into a existing non-empty directory

What is the best practice to clone a Git repository into an existing directory which already includes some other files and folders?

I have created 2 branches dev and master and locally working on dev branch. So I want to clone master branch in www folder which is the root of a website. Then at regular times I want to merge dev branch into master .

Now the problem is that I can't delete www director because it has essential contents. I also can't rename or move it.

Is there a way to fully clone the master branch into the root of www directory without renaming or deleting it's content?

Is there a way to fully clone the master branch into the root ofwww directory without renaming or deleting it's content?

Clone the repo elsewhere (in master branch), then move the checked out files and the .git folder to the existing www/ folder.

You might have to add the existing www/ files in your .gitignore .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM