Tom*_*Tom 7 git command-line bitbucket
所以我试图让我的头围绕Git,并且有需要(为什么我有这个需要我不会进入)能够通过命令行从一个仓库获取文件,并将它们放入一个品牌新存储库没有获取所有以前的提交历史记录.
我现在要做的是git init创建一个新的存储库,然后从我现有的仓库中获取文件,使用克隆或子树(我还没有完全了解这个,所以可能会咆哮错误的树),然后添加,提交,然后将这些推送到我的新存储库.
git init
--- get the files from stock repo ---
git add .
git commit -m 'Initial commit'
git remote add origin <url of my new repo>
git push -u origin master
Run Code Online (Sandbox Code Playgroud)
我的存储库都在Bitbucket上,如果这有所不同,
Cha*_*amo 17
您可以克隆旧存储库,如:
git clone git@bitbucket.org:username/repository.git
Run Code Online (Sandbox Code Playgroud)
然后删除git目录:
rm -rf .git/
Run Code Online (Sandbox Code Playgroud)
现在您创建新的存储库:
git init
Run Code Online (Sandbox Code Playgroud)