Git 使用技巧与仓库历史探索
1. 仅允许快进式拉取
快进式合并是最容易处理的合并方式。可以使用git pull命令结合--ff-only开关,仅合并当前分支的后代提交,避免 Git 进行自动合并,除非是快进式合并。
操作步骤如下:
1. 重复math.bill和math.carol之间的设置步骤以引入合并:
cd $HOME/math.bill echo "ABC" >> another_rename git commit -a -m "Alphabet (on bill)" git push cd $HOME/math.carol echo "ABC" >> another_rename git commit -a -m "Alphabet (on carol)"- 在
math.carol目录中执行以下命令:
git pull --ff-only执行后会看到类似如下输出:
remote: Counting objects: 9, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1),