• 查找2个分支的共同父节点


    1.使用命令来直接查找

    假设有分支A和分支B,那么使用以下命令    【http://stackoverflow.com/questions/1549146/find-common-ancestor-of-two-branches

    git merge-base A B

    就可以查看这2个分支的共同父节点

    现在有chucklu_zhCN分支以及master分支

    $ git merge-base chucklu_zhCN master
    4e67f05995b7d615fce1e97f18deb000d367a6f9

    $ git show 4e67f05
    commit 4e67f05995b7d615fce1e97f18deb000d367a6f9
    Merge: 6d0e241 1583a81
    Author: ChuckLu <邮箱>
    Date: Wed Sep 2 09:15:08 2015 +0800

    Merge branch 'epix37/master' into chucklu/master

     2.使用gitk -all 用肉眼直接查看

    需要注意的是,要查找的2个分支处于未合并的状态才有意义

    否则A和B分支,假如A分支已经合并了B分支。那么这个父节点的查找就没有意义

    父节点肯定是B分支的最后一次提交

    Git log graph, display how two branches are diverging

    had the same issue and landed here, but no answer helped me to display how two branches are diverging. Eventually I did experiment myself and found this worked.

    Given branch A and branch B, I want to see where they diverged.

    git log --oneline --graph --decorate A B `git merge-base A B`^!
    

    Note: Don't forget there is ^! at the end. (It excludes the parents of the commit returned by merge-base.)

    UPDATE

    The one line command above isn't working in case merge base is more than one. In this case do this:

    git merge-base A B -a
    # e.g. output XXXX YYYY
    git log --oneline --graph --decorate A B --not XXXX^ YYYY^
    

    $ git log --oneline --graph --decorate master adockhorn-master `git merge-base adockhorn-master master`^!
    * 2904187e (HEAD -> adockhorn-master, chuck/adockhorn-master, adockhorn/master) Merge pull request #10 from rnilva/fix_prepareOpponent
    |
    | * 82f8b233 Merge
    | |
    | |/
    |/|
    * | 6599156e (adockhorn/Competition2018) removed unnecessary using directive
    * | 66b6bf98 added multiple trials for failed copies since it seems to be undeterministic
    * | e16f4e7f updated gamecloning to be more performant
    * | 707aec95 moved game clone such that it is covered by try catch
    * | df43f236 currentplayer fix by Milva
    | * 8e457aee Fix prepareOpponent and some errors in the core
    |/
    * 96fa6d66 Merge remote-tracking branch 'origin/master'
    |
    | * cd989ca9 Update README.md
    * | 3e1a38f2 updated simulate function to avoid cheating
    |/
    * 7150857f (tag: v1.0) Merge remote-tracking branch 'origin/master'
    |
    | * 3def0468 Updated readme for Hearthstone AI Competition 2019
    :...skipping...
    * 2904187e (HEAD -> adockhorn-master, chuck/adockhorn-master, adockhorn/master) Merge pull request #10 from rnilva/fix_prepareOpponent
    |
    | * 82f8b233 Merge
    | |
    | |/
    |/|
    * | 6599156e (adockhorn/Competition2018) removed unnecessary using directive
    * | 66b6bf98 added multiple trials for failed copies since it seems to be undeterministic
    * | e16f4e7f updated gamecloning to be more performant
    * | 707aec95 moved game clone such that it is covered by try catch
    * | df43f236 currentplayer fix by Milva
    | * 8e457aee Fix prepareOpponent and some errors in the core
    |/
    * 96fa6d66 Merge remote-tracking branch 'origin/master'
    |
    | * cd989ca9 Update README.md
    * | 3e1a38f2 updated simulate function to avoid cheating
    |/
    * 7150857f (tag: v1.0) Merge remote-tracking branch 'origin/master'
    |
    | * 3def0468 Updated readme for Hearthstone AI Competition 2019
    * | 8325cf5f Updated Hearthstone AI Competition Framework for 2019
    |/
    * 43083748 added competition banner
    * 23e2a1d6 added safety measure for targetsetting
    * eb1dc75e updated competition framework for 2019
    |
    * f75d8aa8 Merge pull request #9 from wulfihm/patch-1
    |
    | * | 1895454c Formatting of the print out
    | * | 58f18008 Correct time tracking
    |/ /
    * | 06120318 Merge pull request #8 from TheFlow0360/patch-1
    |
    | * | 540fb136 added game number to exception output
    | * | 46905468 added properties for machine-readability of exception stats
    | * | 08300e8c used exception tracking for stats in POGameHandler
    | * | cb63f307 allow tracking and output of exception stats
    |/ /
    * | 09f8baf6 Merge pull request #7 from TheFlow0360/patch-2
    |
    | * | f84f43fe allow creating POGame with current debug setting
    |/ /
    * | f1cb934d Merge pull request #5 from Jin42/master
    |
    | * 12b5b387 Merge branch 'master' of https://github.com/Jin42/SabberStone
    | |
    | | * 6c19b008 Merge pull request #1 from ADockhorn/master
    | | |
    | |_|/ /
    |/| | |
    * | | | c00eb1d1 Merge pull request #4 from TheFlow0360/patch-1
    |
    | * | | | 01562883 Fixed POGame PartialPrint for Player 2
    |/ / / /
    * | | | a55108aa Merge pull request #3 from MaciekArea7/master
    |
    | * | | | f5c8e57c This commits only adds a parameter 'bool debug' to POGame.getCopy() which allows to override this parameter in a copy. If debug == true, then the copied state is fully printed which is not always wanted.
    |/ / / /
    * | | | 31204f63 Merge pull request #2 from Jin42/master
    |
    | | |/ /
    | |/| |
    * | | | 0a5c0be4 Merge pull request #1 from Jin42/master
    |
    | | | * | c72efcaa Added Simulate function (not 100% stable yet) Partly repaired getCopy
    | | |/ /
    | | * | 42b8eaad Removed accidentally added function to stop a game after 3 Minutes
    | | * | 6b7ded86 Game is now counted as loss, if an exception is thrown
    | |/ /
    | * | ee8abb36 Debug-Flag now more respected
    | * | fd33c306 Stats are now machine readable
    |/ /
    * | 2a8c11d1 Merge remote-tracking branch 'upstream/master'
    * | f0288c68 removed Debug Deck using statement
    * | 45c8534e deleted randomAgentMultipleMoves because it does not comply with the current framework
    * | 67c0db40 Merge remote-tracking branch 'origin/master'
    |
    | * 947d5a44 Merge branch 'master' of https://github.com/ADockhorn/SabberStone
    | |
    | | * | 3f94c268 Merge remote-tracking branch 'upstream/master'
    | * | | 65df32c0 Merge branch 'master' of https://github.com/HearthSim/SabberStone
    | |/ /
    | * | e2437b71 (tag: PreMerge) updated examples and some minor tweks in the framework
    | * | 79004b18 Bug-Fixing competition framework - added debug mode to POGameHandler - switch game object with po_gameobject during player phase - added more copies of "No Way!" to the debug deck
    | * | 3711574f added remaining changes
    | * | 480c6cf2 added Debug Deck to Meta
    | * | 1f917c7c PartialObservation
    | * | fe05a5f8 updated project file
    | * | e8d62c92 added DebugDeck
    | * | b2c6a871 Added GameHandler for Partial Information Games POWrapper not implemented yet
    | * | 419ddf83 Added AbstractAgent and RandomAgent MCTSAgentStub
    | /
    * | 518a2b14 updated gitignore to exclude vscode folder
    * | c7553fe4 fixed some rebase bugs
    * | fdf88056 updated competition framework to avoid some bugs with agents that return a list of PlayerTasks.
    * | 6ac1b98e updated examples and some minor tweks in the framework
    * | 7d0a014e Bug-Fixing competition framework - added debug mode to POGameHandler - switch game object with po_gameobject during player phase - added more copies of "No Way!" to the debug deck
    * | 38885334 added remaining changes
    * | 1a3dd45f added Debug Deck to Meta
    * | 3e588464 PartialObservation
    * | d0c805a3 updated project file
    * | 42878815 added DebugDeck
    * | 153312ef Added GameHandler for Partial Information Games POWrapper not implemented yet
    * | 56f2eae6 Added AbstractAgent and RandomAgent MCTSAgentStub
    /
    | * 515076a9 (chuck/master, master) Update README.md
    | * d8125cc4 Update README.md
    | * a282a14e [TRL_319] Spirit of the Dragonhawk
    | * b4ce9f81 [TRL_390] Daring Fire-Eater Make RemoveEnchantmentTask singleton
    | * 820acb7c [BOT_912] Kangor's Endless Army, fix the magnetic enchantment of Zilliax, refactor AddEnchantmentBlock
    | * 2070a5ef !!!Significant bug fixes - Fix the problem that the cost of changed entities are not modified properly - Fix Counterspell - Fix Arch-Villian Rafaam - More work for Zentimo - Fix the problem of resolving Discover as Neutral heroes - Fix WeaponTask
    | * e580188a [TRL_306] Immortal Prelate
    | * e74f4837 [TRL_085] Zentimo
    | * 96ebaa7d Rework and Clean-up - UnlimitedZone rework - ComplexTask.SummonAllFriendlyDiedThisTurn - Move AddLackeyTask - Fix tests - TODO: Duplicated card name: Elise Starseeker
    | * fe16bf56 Fix DragonInhand In process: refactor Targeting In process: UnlimitedZone rework In process: SummonMinionsDiedThisTurn
    | * dd942322 implement the remaining new cards
    | * 71d96027 Preparing for Saviors of Uldum update - cards Hall of Famed, renamed, and added
    | * 96a3e425 Merge
    | |
    | | * e9810429 updated carddef to 31761 added ReqEntireEntourageNotInPlay(55964)
    | * | cf43ad39 - Re-implement Kazakus - Fix Kazakus - Brann interaction - Fix the implementation of SN1P-SN4P - Fix the implementation of Astral Communion - Minor bug fixes and performance improvements
    | * | c8ab8803 Merge branch 'TEMP' into feature
    | |
    | | * | bda3c0a1 Rise of the Mech card data, buffs, Sn1p-Sn4p
    | * | | 4ac44a0a - Fix wrong caching in RandomCardTask - Remove Card.IsClassCard() - Fix Lotus Assassin
    | * | | ca07e515 Fix tests and broken cards
    | |/ /
    | * | c9fe140a Merge branch 'master' of https://github.com/winnowerhs/SabberStone
    | |
    | | |/
    | |/|
    | | * 87450507 Merge pull request #1 from HearthSim/master
    | | |
    | * | | 8084324f Spellpower rework (#161)
    | * | | 7e87b20f Add riseofshadow cards (#160)
    | | |/
    | |/|
    | * | 9c14acdd Implement Race=ALL, cards "Nightmare Amalgam" and "Hench-Clan Hag" (#159)
    | |/
    | * 362e642c Update README.md
    | * 9bc0496b Update README.md
    | * 65b7eed6 Massive card implementations & Bug fixes (#158)
    | * faf33e0a updated nuget packages
    | * 79414205 removed System.Memory
    | * 93108265 added rise of shadows
    |/
    * 7a6e2be7 (tag: adockhorn-merge-base) Fixed CantBeTargetedBySpells & HeroPowers & Wardruid Loti FULL_ENTITY fixed (#157)

  • 相关阅读:
    根据自己的博客数据统计国内IT人群
    使用dropwizard(5)--加入swagger
    使用dropwizard(4)-加入测试-jacoco代码覆盖率
    使用dropwizard(3)-加入DI-dagger2
    收藏博客
    IntelliJ IDEA 下载安装(含注册码)
    fontawesome图标字体库组件在服务器上显示不出来图标的解决
    MySQL DBA工作角色和职责介绍
    MySQL主主复制(双主复制)配置过程介绍
    MySQL表与表之间的SQL Joins图介绍
  • 原文地址:https://www.cnblogs.com/chucklu/p/4781190.html
Copyright © 2020-2023  润新知