暗黑模式
合并
教程Git
把仓库A的代码合并到仓库B中
仓库B是空的
bash
# 在源仓库A中执行
git remote add bOrigin https://e.coding.net/xxx/xxxx/B.git
git push -u bOrigin main # 把 A 的 main 分支代码提交到 B
1
2
3
2
3
仓库A/B都已存在代码
bash
# Clone the target repository
git clone https://github.com/user/target-repo.git
cd target-repo
# Add the source repository as a remote
git remote add source https://github.com/user/source-repo.git
# Fetch the source repository
git fetch source
# Merge the source branch into the target repository
git merge source/main --allow-unrelated-histories
# Resolve any merge conflicts, then commit and push
git commit
git push origin main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16