git-pretty
目录
[显示]
1.摘要
网上看到一个不错的解决git日常应用的流程图,简单翻译了一下,顺便练习一下graphviz。
对应的graphviz代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
digraph { rankdir=LR; label = "git prretty\n原版地址:http://justinhileman.info/article/git-pretty/git-pretty.pdf"; start [label = "我的git又乱了" , shape = Mrecord]; let_it_stay_ugly_then [label = "就这么放着吧", shape = Mrecord,style=bold]; //start of questions node [shape = diamond,fixedsize=true,width=2.5,height=1.5]; what_mess [label = "git又咋的了?"]; is_already_on_github [label = "已经推送到远程\n仓库(Github)了吗?"]; is_anyone_down_stream [label = "有人从远程仓\n库更新过吗?"]; enouth_to_form_a_lynch_mob [label = "自己的名声和漂亮git\n提交记录哪个重要?"] do_you_hate_them [label = "你想跟其它程序员\n老死不相往来了吗?"] do_an_interactive_rebase [label = "我们要执行rebase命令了"] has_anyone_else_seen_it [label = "已经在远程仓库上了吗?"] how_long_ago[label = "什么时候的commit?"] take_a_mulligan[label = "要改变已有的commit吗?"] what_would_make_this_better[label = "你想改啥?"] keep_it[label = "没提交的文件还留着吗?"] still_have_a_mess[label = "搞定了木有?"] remove_merge_commits[label = "只是想要线性的提交历史?"] node[shape=Mrecord,height=.1,width=.1,fixedsize=false] do_an_interactive_rebase[label = "来一发交互式的rebase"]; reset_and_commit_from_scratch[label = "复位到某个版本并\n进行一次提交"]; split_off[label = "把没提交的文件按逻辑分组,对某组\n文件执行add,之后commit"]; finished[label = "妥妥的",style=bold] subgraph cluster_gitnormal{ label=""; color = white; node[shape=box,style="filled",color=black,fontcolor=white,width=2.5]; reset_hard[label = "git reset --hard"]; reset_hard_head[label = "git reset --hard HEAD^"]; reset[label = "git reset {COMMITISH}"]; rebase[label = "git rebase origin/{branch}"]; revert[label = "git revert {COMMITISH} \n (命令作用跟你想的不一样)"]; add[label = "git add {myfile}"]; amend[label = "git commit --amend"]; add -> amend[constraint=false]; } subgraph cluster_dangerous { label = "命令有风险,把git玩坏了别怪我"; style = dashed; node[shape=box,style="filled",color=black,fontcolor=white]; rebase_i[label = "git rebase -i {COMMITISH}"]; blabla[label = "..."]; push_force[label = "git push --force origin {branch}"]; rebase_i -> blabla-> push_force[constraint=false]; } node[shape=box] send_them_a_note [label = "告诉他们你在修改历史版本"] //lines start -> what_mess [label = "救命啊"]; //uncommited mess what_mess -> keep_it [label = "我这有一堆没提交的乱七八糟的文件"]; keep_it ->split_off[label = "留着"]; split_off->still_have_a_mess; still_have_a_mess->split_off[label = "no"]; still_have_a_mess->finished[label = "yes"]; keep_it ->reset_hard[label = "不要了"]; //git history what_mess -> is_already_on_github [label = "我的git仓库历史看起来太乱了"]; is_already_on_github -> is_anyone_down_stream [label = "yes"]; is_already_on_github -> remove_merge_commits[label = "no"]; is_anyone_down_stream -> enouth_to_form_a_lynch_mob [label = "yes"]; is_anyone_down_stream -> do_an_interactive_rebase [label = "no"]; enouth_to_form_a_lynch_mob -> let_it_stay_ugly_then [label = "名声重要"]; enouth_to_form_a_lynch_mob -> do_you_hate_them [label = "提交记录重要"]; do_you_hate_them -> do_an_interactive_rebase [label = "yes"]; do_you_hate_them -> send_them_a_note [label = "no"]; send_them_a_note -> do_an_interactive_rebase ; do_an_interactive_rebase -> rebase_i; push_force -> finished; //accidentally what_mess -> has_anyone_else_seen_it [label = "我提交错了"]; has_anyone_else_seen_it ->how_long_ago [label ="还没"]; has_anyone_else_seen_it ->revert[label ="yes"]; how_long_ago -> what_would_make_this_better[label = "刚提交的"]; what_would_make_this_better -> add[label = "我少提交了个文件"]; what_would_make_this_better -> amend[label = "提交注释写的不对"]; what_would_make_this_better -> reset_hard_head[label = "我要把上个提交删了"]; how_long_ago -> take_a_mulligan [label = "很久以前的事了"]; take_a_mulligan ->do_an_interactive_rebase [label = "yes"]; take_a_mulligan ->reset_and_commit_from_scratch[label = "no"]; reset_and_commit_from_scratch -> reset; remove_merge_commits ->do_an_interactive_rebase [label = "no"]; remove_merge_commits -> rebase [label = "yes"]; reset_hard -> finished; reset-> split_off; rebase-> finished; amend-> finished; revert-> finished; } |
本作品采用知识共享署名-非商业性使用 4.0 国际许可协议进行许可,转载请注明作者及原网址。
仅有 1 条评论