我恐怕找不到任何类似这种特殊场景的东西.
我有一个有很多历史的git存储库:500多个分支,500多个标签,可以追溯到2007年中期.它包含~19,500次提交.我们想在2010年1月1日之前删除所有历史记录,以使其更小更容易处理(我们将在存档库中保留历史记录的完整副本).
我知道我想要成为新存储库的根目录的提交.但是,我不能找出正确的git mojo来截断repo以从那个提交开始.我猜的是一些变种
git filter-branch
Run Code Online (Sandbox Code Playgroud)
涉及移植是必要的; 它也可能是必要的对待每一个我们要分别保持在200多个分支机构,然后修补回购重新走到一起(这是我不知道该怎么做).
有没有人做过这样的事情?如果重要的话,我有git 1.7.2.3.
我在https://github.com/railstutorial/sample_app_rails_4克隆了回购并对它进行了很多更改(我用它作为我自己的应用程序的起点),现在我想将更改的应用程序推送到回复我自己的github帐户.
如何更改链接到的github repo?
请注意,使用--depth=1参数会阻止您将项目推送到新的存储库.
有关详细信息,请参阅:更改Git远程URL后"远程拒绝"(不允许浅更新)
我用平均堆栈(mean.io)创建了一个项目
mean init
Run Code Online (Sandbox Code Playgroud)
这创建了一个git repo,我想在Bitbucket上推入我自己的私人git repo.我做了:
git remote add origin git@bitbucket.org:my_login/reponame.git
git push -u origin --all
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
! [remote rejected] master -> master (shallow update not allowed)
Run Code Online (Sandbox Code Playgroud)
关于如何将我的本地仓库推入Bitbucket的全新远程仓库的任何建议?
有很多答案表明 git 1.9 消除了浅克隆的限制。尽管如此,我使用的是 2.6.1 并且仍然存在以下基本问题:
首先,我在某处创建了一个空仓库:
cd /tmp
mkdir target
cd target
git init
Run Code Online (Sandbox Code Playgroud)
然后,我浅克隆一些 repo 并将上述 repo 添加为远程:
cd /tmp
git clone --depth 1 git@github.com:muennich/urxvt-perls.git
cd urxvt-perls
git remote add target /tmp/target
Run Code Online (Sandbox Code Playgroud)
最后,我将这个 repo 推送到远程:
git push target master
Run Code Online (Sandbox Code Playgroud)
但后来我得到:
! [remote rejected] master -> master (shallow update not allowed)
error: failed to push some refs to '/tmp/target'
Run Code Online (Sandbox Code Playgroud)
我在这里缺少什么?
我希望摆脱很多我回购协议的旧历史,所以我做了一个浅表克隆以仅获取最后的50次提交:
git clone --depth=50 https://my.repo
Run Code Online (Sandbox Code Playgroud)
那行得通,但是当我创建一个新的Gitlab存储库并尝试将其推送时,出现错误:
git remote remove origin
git remote add origin https://my.repo
git push -u origin --all
[...]
! [remote rejected] master -> master (shallow update not allowed)
Run Code Online (Sandbox Code Playgroud)
但是我只希望这50次提交成为我的新仓库的历史记录。我怎么能告诉git它应该只将这50次提交作为新仓库中的唯一提交?