在 Git 中,合并分支是一种将两个不同的分支中的代码更改合并到一个分支中的操作。这允许团队成员在不同的分支中开发功能和修复错误,并最终将它们合并到主分支或其他稳定分支中。
# 切换分支
$ git checkout lgnew
# 合并
$ git merge master
Merge made by the 'ort' strategy.
lab/test3.txt | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 lab/test3.txt
# 查看提交日志
$ git hist --all
* 1ef2ec3 2023-05-05 | Merge branch 'master' into lgnew (HEAD -> lgnew) [aku]
|\
| * 1c78eab 2023-05-05 | Added teset3.txt (master) [aku]
* | 3d99c8f 2023-05-05 | Added teset2.txt [aku]
|/
* 5dc8b1e 2023-05-05 | Added .gitignore [aku]
* b77158a 2023-05-05 | Moved test.txt to lab [aku]
* 929f644 2023-05-05 | Added 123456 to the test.txt [aku]
| * 739560c 2023-05-05 | Oops,an error committed (tag: oops) [aku]
| * 1ca1854 2023-05-05 | Revert "Added 123 to the test.txt" [aku]
| * 375f4fe 2023-05-05 | Added 123 to the test.txt [aku]
|/
* d7f681f 2023-05-05 | Added abc to the test.txt (tag: v1) [aku]
* 01b8702 2023-05-05 | Add first file (tag: v1-beta) [aku]