我有一个包含多个分支的repo,我希望能够说出每个分支的初始源分支。例如:
- 主机的初始签入
- 对master进行更改
- 功能A的分支主机
- 对功能A进行更改
- 将特征A分支到特征B
- 对功能B进行更改
- 将功能B合并到主功能中
或者如果您想要命令:
git clone <url> test
cd test
echo "Test">test.txt
git add .
git commit -m "Initial checkin"
git push
echo "Updates">>test.txt
git add .
git commit -m "Updates"
git push
git branch featureA
git checkout featureA
git push --set-upstream origin featureA
echo "Updates featureA">>test.txt
git add .
git commit -m "Updates to featureA"
git push
git branch featureB
git checkout featureB
git push --set-upstream origin featureB
echo "Updates featureB">>test.txt
git add .
git commit -m "Updates to featureB"
git push
git checkout master
git merge origin/featureB
git push
但是当我运行git log-all-source时,我看不出featureB来自哪里:
commit d5f1a9d511ff349a35befbe7aa4f41aca75a0e5a refs/heads/featureB
Author: itsme mario
Date: Tue Oct 11 15:16:49 2022 -0400
Updates to featureB
commit f66006c5d87ee2a507da39aa8a8d6f354b454bb8 refs/heads/featureA
Author: itsme mario
Date: Tue Oct 11 15:15:28 2022 -0400
Updates to featureA
commit 9f433234c228029b5efba118001f0afc8ab5c4ee refs/heads/featureA
Author: itsme mario
Date: Tue Oct 11 15:13:52 2022 -0400
Updates
commit 57d41e78fea121977aa7e52177901ac77109b8bb refs/heads/featureA
Author: itsme mario
Date: Tue Oct 11 15:13:23 2022 -0400
Initial checkin
如果我是一个图,它也不显示不同的分支git log--all--source--graph:
* commit d5f1a9d511ff349a35befbe7aa4f41aca75a0e5a refs/heads/featureB
| Author: itsme mario
| Date: Tue Oct 11 15:16:49 2022 -0400
|
| Updates to featureB
|
* commit f66006c5d87ee2a507da39aa8a8d6f354b454bb8 refs/heads/featureA
| Author: itsme mario
| Date: Tue Oct 11 15:15:28 2022 -0400
|
| Updates to featureA
|
* commit 9f433234c228029b5efba118001f0afc8ab5c4ee refs/heads/featureA
| Author: itsme mario
| Date: Tue Oct 11 15:13:52 2022 -0400
|
| Updates
|
* commit 57d41e78fea121977aa7e52177901ac77109b8bb refs/heads/featureA
Author: itsme mario
Date: Tue Oct 11 15:13:23 2022 -0400
Initial checkin
我该怎么做才能让git日志显示featureB的来源(又名featureA通过master(?非常感谢。
Git不记得父分支,也不记得分支从哪里开始。git log命令将显示提交日志。你想要的是:
git show-branch -a
你可以阅读这里的文档,找到你想要的