git使用记录

记录 git 的使用过程中遇到的问题

合并仓库

记录合并 git 仓库的方法,主要就是根据网上查找的

目录情况:
1
2
3
/temp/
├── A
└── B
具体步骤
  • 将 B 合并到 A

    1
    2
    3
    4
    5
    6
    cd temp/A
    git remote add other ../B/
    git fetch other
    git checkout -b B other/main
    git checkout main
    git merge B --allow-unrelated-histories
  • 处理冲突

    直接打开 vscode,点一点,或者 vim 删除不需要的部分,之后(记得 git add)

    1
    git commit -m "merge A&B"
善后
1
2
3
4
git remote -v
git remote remove other
git branch
git branch -D B