【问题标题】:Pass all files from a branch to another将所有文件从一个分支传递到另一个
【发布时间】:2017-06-18 22:05:34
【问题描述】:

我有一个带有两个分支的 git 存储库:master 和 master2。如果我想 将所有现有文件从 master 传递到 master2,我应该使用什么命令?我试过这个,但它没有用

git checkout master2
git checkout master files
git commit -m 'Add file files to master2.'

【问题讨论】:

标签: git github command-line


【解决方案1】:

您有不同的选择:

在顶部合并:

git checkout master2
git merge master

在下面变基:

git checkout master2
git rebase master

重置为精确副本(包括 VCS 历史记录):

git checkout master2
git reset --hard master

【讨论】:

  • 试过但我有这个错误:拒绝合并不相关的历史
  • @bero:尝试将--allow-unrelated-histories 添加到合并命令中。
猜你喜欢
  • 2020-07-12
  • 1970-01-01
  • 2016-10-30
  • 1970-01-01
  • 1970-01-01
  • 2021-04-10
  • 2021-01-07
  • 2020-11-30
  • 1970-01-01
相关资源
最近更新 更多