掌上百科 - PDAWIKI

 找回密码
 免费注册

QQ登录

只需一步,快速开始

查看: 664|回复: 1

[索引] Git 与词典校对 [...]

[复制链接]

该用户从未签到

发表于 2018-1-24 22:13:05 | 显示全部楼层 |阅读模式
本帖最后由 Oeasy 于 2018-1-24 22:29 编辑 ) p$ }' `( M2 d& U1 ]

! `% }3 j; `6 z/ |0 NWindows 10 下试了下。
7 T+ F! \, r9 Z1 j
. f7 e" Z+ z) r$ h6 _3 V1. 安装 Git (略)/ x& U, l) W% _3 s/ S$ r1 z
2. Git bash 下操作+ i$ n- t+ t+ b0 L! ^; Z( d
在 D 盘建一个文件夹 dict4 |+ I1 ?- ^- q+ q3 K1 E* d# _
$ mkdir D:/dict
! A; N: u4 S* Q1 i$ {+ i$ cd D:/dict3 W8 U0 }! U8 Z
$ pwd
) v& {) G" ]; d>/d/dict* C6 U7 y) h" R" w

. y8 A" a  G4 k: ]) y$ git init
! _4 p% _2 T8 y>Initialized empty Git repository in D:/dict/.git/  B4 d6 O* m5 |% W
; I# M& D5 _& |$ T0 |
新建一个纯文本文件 dict.md  ,放到 D:/dict 下
' Q0 f! k% o# J9 ?) B1 e! @( i8 F: R. e) Y! b3 }. }$ {0 `
随便在 dict.md 下敲点内容。
0 V! r+ B( v2 v" p6 N% p># donkey work
& V6 X" u* P/ d: ?/ O  |( y; N: b单调乏味的苦差事
" D1 z* Q& s# f+ L" S% q- f, c* s8 }, U( b: M
$ git add dict.md8 B7 h5 p: g& ]# q( c3 q

8 a9 W; f: {0 v/ b1 `  H; G$ git commit -m "卧槽,终于会了"
1 ^2 {9 S+ e4 n& G* X- O0 }1 L>[master (root-commit) 5ccfce8] 卧槽,终于会了+ P( v6 {* P) k5 m) X6 D% D! c
1 file changed, 2 insertions(+)$ I3 d2 {8 C0 e7 F" h
create mode 100644 dict.md
* ]1 d9 D3 n, C$ p# x' @" Z% n5 l# e" ?! ]+ B
继续修改 dict.md# g* d! z) z: @1 v2 [
># donkey work+ _% w8 x6 S6 v
单调乏味的苦差事
* S' K) q7 H( d7 I# drudgery2 W( g& P6 C4 b, `; f
单调乏味的工作' T! h. _0 R8 k; p" x
, h) }: G3 n2 f8 O6 ?
$ git status% e6 W- V& n8 t# y& v! V3 E1 W8 C
>On branch master9 U1 U) R/ R% p6 w3 C
Changes not staged for commit:& ^# e( N  J0 s5 {+ h$ @
  (use "git add <file>..." to update what will be committed)# M8 X; n% Q/ Y/ r" H0 m2 G$ d
  (use "git checkout -- <file>..." to discard changes in working directory)- F4 x9 `! z/ r7 U4 [7 D
( u+ U, W8 j6 @7 x) \8 k# ]
        modified:   dict.md
' F- R; k% Z* p. ^; V( D& S) w% V5 c( h4 H% o* t5 Q6 C/ l: B
no changes added to commit (use "git add" and/or "git commit -a")$ ?# ]3 l; q' M0 w. X1 D7 w

. x( \. g1 F! W& H$ d2 u
0 P7 H+ R+ Z' W' V6 c$ git diff dict.md
; f/ f* Z% A. k) p>diff --git a/dict.md b/dict.md  ^' p0 k( ^  q) i
index 908125d..1e31895 100644
: Q/ \% t- ?" o9 D6 D" l--- a/dict.md) R4 F& a7 q7 o- O3 e' ]
+++ b/dict.md
/ r; g( o& R: ?7 D% K3 A@@ -1,2 +1,4 @@
. O3 @1 v' I4 q1 Q # donkey work
0 |7 W' R& P; Q- H$ Y 单调乏味的苦差事6 n8 ^, `. E! R
+# drudgery; i3 }! T$ c6 R$ n: G. X$ U, c
+单调乏味的工作
! C5 m. k3 |, b  i9 |0 D! K; I# H
* \% \: q, [9 Y$ git add dict.md( p* E. J3 N6 I. R

" m4 f$ L4 b3 s5 |5 K, a$ git status
* d1 @7 C& l  d: j6 `>On branch master
* w2 v3 A% w9 z) m2 IChanges to be committed:
  D+ E# G# ]/ r( W- ]  (use "git reset HEAD <file>..." to unstage)2 C' t0 Q9 F7 ~# H' y5 e  \

: X1 c  r6 L% j* d        modified:   dict.md
9 Y  `( E) |. w8 g$ i( T
+ O1 N* |9 G; y: B, C) e# \, ]! [- }+ C3 Z8 w
$ git commit -m "添加了第 2 个词条"7 Z9 l! a% Y; x* j$ C3 r; Y+ H
>[master 296bc69] 添加了第 2 个词条
: J  A) b8 ]; F3 W 1 file changed, 2 insertions(+)
- A; u# u0 r9 s" l/ R, [% |
; Z( }; F* s: g: P8 L$ git status- B8 n  k2 H" \* j
>On branch master
; r8 q& Q; o; O* m  H; }1 H; Vnothing to commit, working tree clean
4 x$ @! a/ k# R1 F, `; c3 {
& \) _: c- ?' q7 j! O$ {6 L; H$ git log; N( I: Q" C$ y0 Y! |4 `8 X
$ git log --pretty=oneline4 {! u# M4 Y! _6 ?
$ git reflog
+ F! v4 `* P/ b5 h! J7 e& ~) W6 ~& k' s8 }6 k$ I+ s+ v2 s/ g
$ git reset --hard HEAD^: L, i2 J2 U% D$ v! s: m4 y
. n: [8 q9 I7 f! I4 t
直接在 Atom 下,更简单直观。$ a% [4 `8 f3 J/ G: B# J

$ e& r" c3 E2 l* j3 F' N* w
! M5 {' r) S  `( j6 H* N6 L7 V& F7 q- N; L: u

该用户从未签到

发表于 2018-1-24 22:32:24 | 显示全部楼层
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

小黑屋|手机版|Archiver|PDAWIKI |网站地图

GMT+8, 2024-3-29 14:32 , Processed in 0.032671 second(s), 10 queries , MemCache On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表