git与github

git

环境变量

当我们安装了git, 需要配置一些环境变量, 环境变量分为三个级别
    系统级别
    用户级别
    项目级别
> 一般情况下我们配置最多的是 `用户级别`
    用户名
    git config --global user.name "lewen"

    用户邮箱
    git config --global user.email "fadewalk@163.com"

    列出自己的环境变量
    git config --list
8
8
 
1
    用户名
2
    git config --global user.name "lewen"
3
4
    用户邮箱
5
    git config --global user.email "fadewalk@163.com"
6
7
    列出自己的环境变量
8
    git config --list

> 当我们配置了这些环境变量之后, 除了通过 `git config --list` 查看之外, 还可以通过文件查看
    # mac/linux 
    vi ~/.gitconfig
    # windows
    打开 C:\Users\Magina\.gitconfig (其中Magina为我的用户名)


Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ touch style.css

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        style.css

nothing added to commit but untracked files present (use "git add" to track)

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git add style.css

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git commit -m 'add style.css'
[master 5715233] add style.css
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 style.css

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
nothing to commit, working tree clean


Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git log
commit 57152331752788aef882372fbd080a6066783eb1 (HEAD -> master)
Author: lewen <fadewalk@163.com>
Date:   Sun Oct 28 09:37:02 2018 +0800

    add style.css

commit f0f236eba4566f7f8753d2a3780b96a5e1722805
Author: lewen <fadewalk@163.com>
Date:   Sun Oct 28 09:31:18 2018 +0800

    add index.html

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git rflog
git: 'rflog' is not a git command. See 'git --help'.

The most similar command is
        reflog

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git reflog
5715233 (HEAD -> master) HEAD@{0}: commit: add style.css
f0f236e HEAD@{1}: commit (initial): add index.html

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git log --oneline
5715233 (HEAD -> master) add style.css
f0f236e add index.html




63
63
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ touch style.css
3
4
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
5
$ git status
6
On branch master
7
Untracked files:
8
  (use "git add <file>..." to include in what will be committed)
9
10
        style.css
11
12
nothing added to commit but untracked files present (use "git add" to track)
13
14
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
15
$ git add style.css
16
17
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
18
$ git commit -m 'add style.css'
19
[master 5715233] add style.css
20
 1 file changed, 0 insertions(+), 0 deletions(-)
21
 create mode 100644 style.css
22
23
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
24
$ git status
25
On branch master
26
nothing to commit, working tree clean
27
28
29
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
30
$ git log
31
commit 57152331752788aef882372fbd080a6066783eb1 (HEAD -> master)
32
Author: lewen <fadewalk@163.com>
33
Date:   Sun Oct 28 09:37:02 2018 +0800
34
35
    add style.css
36
37
commit f0f236eba4566f7f8753d2a3780b96a5e1722805
38
Author: lewen <fadewalk@163.com>
39
Date:   Sun Oct 28 09:31:18 2018 +0800
40
41
    add index.html
42
43
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
44
$ git rflog
45
git: 'rflog' is not a git command. See 'git --help'.
46
47
The most similar command is
48
        reflog
49
50
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
51
$ git reflog
52
5715233 (HEAD -> master) HEAD@{0}: commit: add style.css
53
f0f236e HEAD@{1}: commit (initial): add index.html
54
55
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
56
$ git log --oneline
57
5715233 (HEAD -> master) add style.css
58
f0f236e add index.html
59
60
61
62
63
git commit -m ""

rm 
mv     对未添加到暂存区的文件操作
git mv 
git rm 对暂存区的文件修改删除管理


Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ touch test.js

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git add test.js

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   test.js

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   test.js
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ rm test.js

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ ls
index.html  main.js  style.css

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   test.js

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        deleted:    test.js

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git checkout -- test.js

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ ls
index.html  main.js  style.css  test.js

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   test.js
56
56
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ touch test.js
3
4
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
5
$ git add test.js
6
7
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
8
$ git status
9
On branch master
10
Changes to be committed:
11
  (use "git reset HEAD <file>..." to unstage)
12
13
        new file:   test.js
14
15
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
16
$ git status
17
On branch master
18
Changes to be committed:
19
  (use "git reset HEAD <file>..." to unstage)
20
21
        new file:   test.js
22
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
23
$ rm test.js
24
25
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
26
$ ls
27
index.html  main.js  style.css
28
29
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
30
$ git status
31
On branch master
32
Changes to be committed:
33
  (use "git reset HEAD <file>..." to unstage)
34
35
        new file:   test.js
36
37
Changes not staged for commit:
38
  (use "git add/rm <file>..." to update what will be committed)
39
  (use "git checkout -- <file>..." to discard changes in working directory)
40
41
        deleted:    test.js
42
43
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
44
$ git checkout -- test.js
45
46
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
47
$ ls
48
index.html  main.js  style.css  test.js
49
50
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
51
$ git status
52
On branch master
53
Changes to be committed:
54
  (use "git reset HEAD <file>..." to unstage)
55
56
        new file:   test.js
#被添加到暂存区的文件才可以被checkout 恢复到工作区

# 删除暂存区,而保留工作区
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git rm test.js
error: the following file has changes staged in the index:
    test.js
(use --cached to keep the file, or -f to force removal)

 Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git rm --cached test.js
rm 'test.js'
10
10
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ git rm test.js
3
error: the following file has changes staged in the index:
4
    test.js
5
(use --cached to keep the file, or -f to force removal)
6
7
 Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
8
$ git rm --cached test.js
9
rm 'test.js'
10

# 删除暂存区和工作区的,checkout 不能再回撤
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   test.js


Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git rm -f test.js
rm 'test.js'

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ ls
index.html  main.js  style.css
17
17
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ git status
3
On branch master
4
Changes to be committed:
5
  (use "git reset HEAD <file>..." to unstage)
6
7
        new file:   test.js
8
9
10
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
11
$ git rm -f test.js
12
rm 'test.js'
13
14
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
15
$ ls
16
index.html  main.js  style.css
17




Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git revert HEAD~4
[master 4a9c170] Revert "rm main.js"
 1 file changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 main.js
6
6
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ git revert HEAD~4
3
[master 4a9c170] Revert "rm main.js"
4
 1 file changed, 0 insertions(+), 0 deletions(-)
5
 delete mode 100644 main.js
6

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git reflog
4a9c170 (HEAD -> master) HEAD@{0}: revert: Revert "rm main.js"
39d849d HEAD@{1}: revert: Revert "Revert "Revert "rm main.js"""
0c6e419 HEAD@{2}: revert: Revert "Revert "rm main.js""
9847b18 HEAD@{3}: revert: Revert "rm main.js"
119efc5 HEAD@{4}: commit: rm main.js
9adcd90 HEAD@{5}: commit: rm main.js
5715233 HEAD@{6}: commit: add style.css
f0f236e HEAD@{7}: commit (initial): add index.html

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ ls
index.html  style.css

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git revert HEAD~6
[master 66521e2] Revert "add style.css"
 1 file changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 style.css

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ ls
index.html
25
25
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ git reflog
3
4a9c170 (HEAD -> master) HEAD@{0}: revert: Revert "rm main.js"
4
39d849d HEAD@{1}: revert: Revert "Revert "Revert "rm main.js"""
5
0c6e419 HEAD@{2}: revert: Revert "Revert "rm main.js""
6
9847b18 HEAD@{3}: revert: Revert "rm main.js"
7
119efc5 HEAD@{4}: commit: rm main.js
8
9adcd90 HEAD@{5}: commit: rm main.js
9
5715233 HEAD@{6}: commit: add style.css
10
f0f236e HEAD@{7}: commit (initial): add index.html
11
12
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
13
$ ls
14
index.html  style.css
15
16
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
17
$ git revert HEAD~6
18
[master 66521e2] Revert "add style.css"
19
 1 file changed, 0 insertions(+), 0 deletions(-)
20
 delete mode 100644 style.css
21
22
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
23
$ ls
24
index.html
25

回撤是对某次操作的回撤

因为误操作,但某次add了文件到版本库,一回撤revert,本地和版本库的也给我删掉了(不爽),我想保存本地工作区的。
这里可以用 git rm --cached 文件名     删除版本库里面的


git reset HEAD --soft  之前提交的日志也会没有!!!!
不再保留该点之后的   将HEAD指针直接指向某个版本,将内容回撤到暂存
 
回撤到暂存区,没有被commit     soft
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git reset HEAD~11 --soft

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ ls
index.html  main.js  style.css

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   main.js
15
15
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ git reset HEAD~11 --soft
3
4
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
5
$ ls
6
index.html  main.js  style.css
7
8
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
9
$ git status
10
On branch master
11
Changes to be committed:
12
  (use "git reset HEAD <file>..." to unstage)
13
14
        new file:   main.js
15

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ ls
index.html  main.js  style.css

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git log --oneline
5715233 (HEAD -> master) add style.css
f0f236e add index.html
9
9
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ ls
3
index.html  main.js  style.css
4
5
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
6
$ git log --oneline
7
5715233 (HEAD -> master) add style.css
8
f0f236e add index.html
9

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git log  --oneline
5715233 (HEAD -> master) add style.css
f0f236e add index.html

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   main.js


Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git commit -m 'add main.js'
[master a461304] add main.js
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 main.js

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git log --oneline
a461304 (HEAD -> master) add main.js
5715233 add style.css
f0f236e add index.html
26
26
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ git log  --oneline
3
5715233 (HEAD -> master) add style.css
4
f0f236e add index.html
5
6
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
7
$ git status
8
On branch master
9
Changes to be committed:
10
  (use "git reset HEAD <file>..." to unstage)
11
12
        new file:   main.js
13
14
15
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
16
$ git commit -m 'add main.js'
17
[master a461304] add main.js
18
 1 file changed, 0 insertions(+), 0 deletions(-)
19
 create mode 100644 main.js
20
21
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
22
$ git log --oneline
23
a461304 (HEAD -> master) add main.js
24
5715233 add style.css
25
f0f236e add index.html
26

回撤到工作区 mixed    之前提交的日志也会没有!!!!
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git reset HEAD^ --mixed

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ ls
index.html  main.js  style.css

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        main.js

nothing added to commit but untracked files present (use "git add" to track)
17
17
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ git reset HEAD^ --mixed
3
4
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
5
$ ls
6
index.html  main.js  style.css
7
8
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
9
$ git status
10
On branch master
11
Untracked files:
12
  (use "git add <file>..." to include in what will be committed)
13
14
        main.js
15
16
nothing added to commit but untracked files present (use "git add" to track)
17

回撤到某个版本,之后的操作暂存区,工作区都没有,【不能修复】
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git reset HEAD^ --hard
HEAD is now at 5715233 add style.css

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ ls
index.html  style.css

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
nothing to commit, working tree clean



Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git log --oneline
5715233 (HEAD -> master) add style.css
f0f236e add index.html
20
20
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ git reset HEAD^ --hard
3
HEAD is now at 5715233 add style.css
4
5
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
6
$ ls
7
index.html  style.css
8
9
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
10
$ git status
11
On branch master
12
nothing to commit, working tree clean
13
14
15
16
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
17
$ git log --oneline
18
5715233 (HEAD -> master) add style.css
19
f0f236e add index.html
20




分支



Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
nothing to commit, working tree clean

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ cat index.html
git first

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git checkout DEV
Switched to branch 'DEV'

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (DEV)
$ LS
index.html  main.js  style.css

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (DEV)
$ CAT in
CAT: in: No such file or directory

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (DEV)
$ cat index.html
git first
git hub
26
26
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ git status
3
On branch master
4
nothing to commit, working tree clean
5
6
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
7
$ cat index.html
8
git first
9
10
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
11
$ git checkout DEV
12
Switched to branch 'DEV'
13
14
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (DEV)
15
$ LS
16
index.html  main.js  style.css
17
18
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (DEV)
19
$ CAT in
20
CAT: in: No such file or directory
21
22
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (DEV)
23
$ cat index.html
24
git first
25
git hub
26

合并
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git branch
  dev
* master

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git merge dev
Updating 8bf231b..e574e73
Fast-forward
 index.html | 1 +
 1 file changed, 1 insertion(+)

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
nothing to commit, working tree clean

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git log --oneline
e574e73 (HEAD -> master, dev) modify index.html
8bf231b add main.js
5715233 add style.css
f0f236e add index.html
24
24
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ git branch
3
  dev
4
* master
5
6
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
7
$ git merge dev
8
Updating 8bf231b..e574e73
9
Fast-forward
10
 index.html | 1 +
11
 1 file changed, 1 insertion(+)
12
13
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
14
$ git status
15
On branch master
16
nothing to commit, working tree clean
17
18
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
19
$ git log --oneline
20
e574e73 (HEAD -> master, dev) modify index.html
21
8bf231b add main.js
22
5715233 add style.css
23
f0f236e add index.html
24






合并分支,冲突时,需要解决冲突,并add ,commit
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git merge dev
Auto-merging readme.md
CONFLICT (add/add): Merge conflict in readme.md
Automatic merge failed; fix conflicts and then commit the result.

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master|MERGING)
$ git commit -m "merge dev"
error: Committing is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
U       readme.md

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master|MERGING)
$ git status
On branch master
You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

Unmerged paths:
  (use "git add <file>..." to mark resolution)

        both added:      readme.md

no changes added to commit (use "git add" and/or "git commit -a")

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master|MERGING)
$ git add readme.md

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master|MERGING)
$ git commit -m "merge dev"
[master 6d247aa] merge dev

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
nothing to commit, working tree clean

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git log --oneline
6d247aa (HEAD -> master) merge dev
7de3869 modify inde.html
40ab7c7 add readme.md
82721b0 (dev) add readme.md
74b1c6e modfy content
e574e73 modify index.html
8bf231b add main.js
5715233 add style.css
f0f236e add index.html

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ cat readme.md
branch dev
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
57
57
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ git merge dev
3
Auto-merging readme.md
4
CONFLICT (add/add): Merge conflict in readme.md
5
Automatic merge failed; fix conflicts and then commit the result.
6
7
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master|MERGING)
8
$ git commit -m "merge dev"
9
error: Committing is not possible because you have unmerged files.
10
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
11
hint: as appropriate to mark resolution and make a commit.
12
fatal: Exiting because of an unresolved conflict.
13
U       readme.md
14
15
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master|MERGING)
16
$ git status
17
On branch master
18
You have unmerged paths.
19
  (fix conflicts and run "git commit")
20
  (use "git merge --abort" to abort the merge)
21
22
Unmerged paths:
23
  (use "git add <file>..." to mark resolution)
24
25
        both added:      readme.md
26
27
no changes added to commit (use "git add" and/or "git commit -a")
28
29
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master|MERGING)
30
$ git add readme.md
31
32
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master|MERGING)
33
$ git commit -m "merge dev"
34
[master 6d247aa] merge dev
35
36
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
37
$ git status
38
On branch master
39
nothing to commit, working tree clean
40
41
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
42
$ git log --oneline
43
6d247aa (HEAD -> master) merge dev
44
7de3869 modify inde.html
45
40ab7c7 add readme.md
46
82721b0 (dev) add readme.md
47
74b1c6e modfy content
48
e574e73 modify index.html
49
8bf231b add main.js
50
5715233 add style.css
51
f0f236e add index.html
52
53
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
54
$ cat readme.md
55
branch dev
56
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
57

非快速合并,可以有合并分支的log
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git merge dev --no-ff -m "merge dev class --no-ff"
Merge made by the 'recursive' strategy.
 index.html | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git log --oneline
909293b (HEAD -> master) merge dev class --no-ff
c75563d (dev) add class container
6d247aa merge dev
7de3869 modify inde.html
40ab7c7 add readme.md
82721b0 add readme.md
74b1c6e modfy content
e574e73 modify index.html
8bf231b add main.js
5715233 add style.css
f0f236e add index.html

21
21
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ git merge dev --no-ff -m "merge dev class --no-ff"
3
Merge made by the 'recursive' strategy.
4
 index.html | 6 +++++-
5
 1 file changed, 5 insertions(+), 1 deletion(-)
6
7
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
8
$ git log --oneline
9
909293b (HEAD -> master) merge dev class --no-ff
10
c75563d (dev) add class container
11
6d247aa merge dev
12
7de3869 modify inde.html
13
40ab7c7 add readme.md
14
82721b0 add readme.md
15
74b1c6e modfy content
16
e574e73 modify index.html
17
8bf231b add main.js
18
5715233 add style.css
19
f0f236e add index.html
20
21




当我们在自己的dev分支开发时,项目经理说bug出现需要修改。
此时,自己在开发的分支还没完。修改完bug,不好直接提交。去master再克隆一份,查找修改又太麻烦。


通过dev 分支修改bug后add, commit
但在切换到master 分支时,dev 分支下被修改的内容也会导致master里面被修改
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$ git add readme.md

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$ git commit -m "modify dev2 readme.md"
[dev2 c067bc9] modify dev2 readme.md
 1 file changed, 1 insertion(+), 1 deletion(-)

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$ git checkout master
Switched to branch 'master'
M       index.html

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   index.html

no changes added to commit (use "git add" and/or "git commit -a")

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git merge dev2 --no-ff -m "merge dev2 readme.md test"
Merge made by the 'recursive' strategy.
 readme.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   index.html

no changes added to commit (use "git add" and/or "git commit -a")

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git checkout -b bug_001
Switched to a new branch 'bug_001'
M       index.html

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
$ git branch
* bug_001
  dev2
  master

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
$ git status
On branch bug_001
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   index.html

no changes added to commit (use "git add" and/or "git commit -a")

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
$ git checkout dev2
Switched to branch 'dev2'
M       index.html

75
75
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
2
$ git add readme.md
3
4
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
5
$ git commit -m "modify dev2 readme.md"
6
[dev2 c067bc9] modify dev2 readme.md
7
 1 file changed, 1 insertion(+), 1 deletion(-)
8
9
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
10
$ git checkout master
11
Switched to branch 'master'
12
M       index.html
13
14
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
15
$ git status
16
On branch master
17
Changes not staged for commit:
18
  (use "git add <file>..." to update what will be committed)
19
  (use "git checkout -- <file>..." to discard changes in working directory)
20
21
        modified:   index.html
22
23
no changes added to commit (use "git add" and/or "git commit -a")
24
25
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
26
$ git merge dev2 --no-ff -m "merge dev2 readme.md test"
27
Merge made by the 'recursive' strategy.
28
 readme.md | 2 +-
29
 1 file changed, 1 insertion(+), 1 deletion(-)
30
31
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
32
$ git status
33
On branch master
34
Changes not staged for commit:
35
  (use "git add <file>..." to update what will be committed)
36
  (use "git checkout -- <file>..." to discard changes in working directory)
37
38
        modified:   index.html
39
40
no changes added to commit (use "git add" and/or "git commit -a")
41
42
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
43
$
44
45
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
46
$
47
48
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
49
$ git checkout -b bug_001
50
Switched to a new branch 'bug_001'
51
M       index.html
52
53
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
54
$ git branch
55
* bug_001
56
  dev2
57
  master
58
59
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
60
$ git status
61
On branch bug_001
62
Changes not staged for commit:
63
  (use "git add <file>..." to update what will be committed)
64
  (use "git checkout -- <file>..." to discard changes in working directory)
65
66
        modified:   index.html
67
68
no changes added to commit (use "git add" and/or "git commit -a")
69
70
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
71
$ git checkout dev2
72
Switched to branch 'dev2'
73
M       index.html
74
75

git stash 将dev的修改封存起来,
再切换到bug分支,就不会提示有未被add 的文件
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$ git stash
Saved working directory and index state WIP on dev2: c067bc9 modify dev2 readme.md

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$ git stash
No local changes to save

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$ git checkout bug_001
Switched to branch 'bug_001'

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
$ git status
On branch bug_001
nothing to commit, working tree clean

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
$ ls
index.html  main.js  readme.md  style.css

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
$ cat index.html
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>git-test-dev</title>
</head>
<body>
git test dev2

<div class="container">

</div>
</body>
</html>

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)

    
    ##bug 修改
    
    
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
$ git status
On branch bug_001
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   readme.md

no changes added to commit (use "git add" and/or "git commit -a")

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
$ git add readme.md

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
$ git commit -m "bug fix on bug brabch"
[bug_001 e29c5c9] bug fix on bug brabch
 1 file changed, 1 insertion(+), 1 deletion(-)

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
$ git checkout master
Switched to branch 'master'

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git status
On branch master
nothing to commit, working tree clean

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git merge bug_001 --no-ff -m "merge bug_001"
Merge made by the 'recursive' strategy.
 readme.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git log --oneline
5b08413 (HEAD -> master) merge bug_001
e29c5c9 (bug_001) bug fix on bug brabch
c694478 merge dev2 readme.md test
c067bc9 (dev2) modify dev2 readme.md
909293b merge dev class --no-ff
c75563d add class container
6d247aa merge dev
7de3869 modify inde.html
40ab7c7 add readme.md
82721b0 add readme.md
74b1c6e modfy content
e574e73 modify index.html
8bf231b add main.js
5715233 add style.css
f0f236e add index.html

101
101
 
1
2
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
3
$ git stash
4
Saved working directory and index state WIP on dev2: c067bc9 modify dev2 readme.md
5
6
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
7
$ git stash
8
No local changes to save
9
10
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
11
$ git checkout bug_001
12
Switched to branch 'bug_001'
13
14
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
15
$ git status
16
On branch bug_001
17
nothing to commit, working tree clean
18
19
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
20
$ ls
21
index.html  main.js  readme.md  style.css
22
23
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
24
$ cat index.html
25
<!doctype html>
26
<html lang="en">
27
<head>
28
    <meta charset="UTF-8">
29
    <meta name="viewport"
30
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
31
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
32
    <title>git-test-dev</title>
33
</head>
34
<body>
35
git test dev2
36
37
<div class="container">
38
39
</div>
40
</body>
41
</html>
42
43
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
44
45
    
46
    ##bug 修改
47
    
48
    
49
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
50
$ git status
51
On branch bug_001
52
Changes not staged for commit:
53
  (use "git add <file>..." to update what will be committed)
54
  (use "git checkout -- <file>..." to discard changes in working directory)
55
56
        modified:   readme.md
57
58
no changes added to commit (use "git add" and/or "git commit -a")
59
60
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
61
$ git add readme.md
62
63
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
64
$ git commit -m "bug fix on bug brabch"
65
[bug_001 e29c5c9] bug fix on bug brabch
66
 1 file changed, 1 insertion(+), 1 deletion(-)
67
68
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (bug_001)
69
$ git checkout master
70
Switched to branch 'master'
71
72
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
73
$ git status
74
On branch master
75
nothing to commit, working tree clean
76
77
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
78
$ git merge bug_001 --no-ff -m "merge bug_001"
79
Merge made by the 'recursive' strategy.
80
 readme.md | 2 +-
81
 1 file changed, 1 insertion(+), 1 deletion(-)
82
83
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
84
$ git log --oneline
85
5b08413 (HEAD -> master) merge bug_001
86
e29c5c9 (bug_001) bug fix on bug brabch
87
c694478 merge dev2 readme.md test
88
c067bc9 (dev2) modify dev2 readme.md
89
909293b merge dev class --no-ff
90
c75563d add class container
91
6d247aa merge dev
92
7de3869 modify inde.html
93
40ab7c7 add readme.md
94
82721b0 add readme.md
95
74b1c6e modfy content
96
e574e73 modify index.html
97
8bf231b add main.js
98
5715233 add style.css
99
f0f236e add index.html
100
101




回到dev,还原状态
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git checkout dev2
Switched to branch 'dev2'

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$  git stash pop
On branch dev2
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   index.html

no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (786d6cbea52dfb94093bb015ee988e2cf10ab827)

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$  git stash
Saved working directory and index state WIP on dev2: c067bc9 modify dev2 readme.md

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$  git stash list
stash@{0}: WIP on dev2: c067bc9 modify dev2 readme.md

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$  git stash pop apply stash@{0}
Too many revisions specified: 'apply' 'stash@{0}'

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$  git stash list
stash@{0}: WIP on dev2: c067bc9 modify dev2 readme.md

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$  git stash apply stash@{0}
On branch dev2
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   index.html

no changes added to commit (use "git add" and/or "git commit -a")

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
45
45
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
2
$ git checkout dev2
3
Switched to branch 'dev2'
4
5
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
6
$  git stash pop
7
On branch dev2
8
Changes not staged for commit:
9
  (use "git add <file>..." to update what will be committed)
10
  (use "git checkout -- <file>..." to discard changes in working directory)
11
12
        modified:   index.html
13
14
no changes added to commit (use "git add" and/or "git commit -a")
15
Dropped refs/stash@{0} (786d6cbea52dfb94093bb015ee988e2cf10ab827)
16
17
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
18
$  git stash
19
Saved working directory and index state WIP on dev2: c067bc9 modify dev2 readme.md
20
21
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
22
$  git stash list
23
stash@{0}: WIP on dev2: c067bc9 modify dev2 readme.md
24
25
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
26
$  git stash pop apply stash@{0}
27
Too many revisions specified: 'apply' 'stash@{0}'
28
29
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
30
$  git stash list
31
stash@{0}: WIP on dev2: c067bc9 modify dev2 readme.md
32
33
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
34
$  git stash apply stash@{0}
35
On branch dev2
36
Changes not staged for commit:
37
  (use "git add <file>..." to update what will be committed)
38
  (use "git checkout -- <file>..." to discard changes in working directory)
39
40
        modified:   index.html
41
42
no changes added to commit (use "git add" and/or "git commit -a")
43
44
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
45

封存自己的修改。创建分支,修改bug,合并分支。提交
反回自己的dev,还原状态



特性分支

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$ git checkout -b feature_001
Switched to a new branch 'feature_001'
M       index.html

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (feature_001)
$ git checkout master
Switched to branch 'master'
M       index.html

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
$ git branch  -d feature_001
Deleted branch feature_001 (was c067bc9).
14
14
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
2
$ git checkout -b feature_001
3
Switched to a new branch 'feature_001'
4
M       index.html
5
6
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (feature_001)
7
$ git checkout master
8
Switched to branch 'master'
9
M       index.html
10
11
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (master)
12
$ git branch  -d feature_001
13
Deleted branch feature_001 (was c067bc9).
14
root

git commit -am  “”
已经被add 过的文件,被修改后,需要再次add ,commit
git commit -am  “” 可以跳过add ,直接提交最新的更新
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$ git status
On branch dev2
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        two-in-one.txt

nothing added to commit but untracked files present (use "git add" to track)

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$ git add two-in-one.txt

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$ echo test>two-in-one.txt

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$ git status
On branch dev2
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   two-in-one.txt

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   two-in-one.txt


Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$ git commit -am "add two in one"
warning: LF will be replaced by CRLF in two-in-one.txt.
The file will have its original line endings in your working directory
[dev2 6bd373a] add two in one
 1 file changed, 1 insertion(+)
 create mode 100644 two-in-one.txt

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$ git status
On branch dev2
nothing to commit, working tree clean

Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
$ git log --oneline
6bd373a (HEAD -> dev2) add two in one
7f17b42 add style.css link file
c067bc9 modify dev2 readme.md
909293b merge dev class --no-ff
c75563d add class container
6d247aa merge dev
7de3869 modify inde.html
40ab7c7 add readme.md
82721b0 add readme.md
74b1c6e modfy content
e574e73 modify index.html
8bf231b add main.js
5715233 add style.css
f0f236e add index.html
x
61
 
1
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
2
$ git status
3
On branch dev2
4
Untracked files:
5
  (use "git add <file>..." to include in what will be committed)
6
7
        two-in-one.txt
8
9
nothing added to commit but untracked files present (use "git add" to track)
10
11
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
12
$ git add two-in-one.txt
13
14
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
15
$ echo test>two-in-one.txt
16
17
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
18
$ git status
19
On branch dev2
20
Changes to be committed:
21
  (use "git reset HEAD <file>..." to unstage)
22
23
        new file:   two-in-one.txt
24
25
Changes not staged for commit:
26
  (use "git add <file>..." to update what will be committed)
27
  (use "git checkout -- <file>..." to discard changes in working directory)
28
29
        modified:   two-in-one.txt
30
31
32
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
33
$ git commit -am "add two in one"
34
warning: LF will be replaced by CRLF in two-in-one.txt.
35
The file will have its original line endings in your working directory
36
[dev2 6bd373a] add two in one
37
 1 file changed, 1 insertion(+)
38
 create mode 100644 two-in-one.txt
39
40
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
41
$ git status
42
On branch dev2
43
nothing to commit, working tree clean
44
45
Administrator@lewenbook MINGW64 /e/PlayData/git/demo1 (dev2)
46
$ git log --oneline
47
6bd373a (HEAD -> dev2) add two in one
48
7f17b42 add style.css link file
49
c067bc9 modify dev2 readme.md
50
909293b merge dev class --no-ff
51
c75563d add class container
52
6d247aa merge dev
53
7de3869 modify inde.html
54
40ab7c7 add readme.md
55
82721b0 add readme.md
56
74b1c6e modfy content
57
e574e73 modify index.html
58
8bf231b add main.js
59
5715233 add style.css
60
f0f236e add index.html
61

github

posted @ 2020-06-08 21:11  Fadewalk  阅读(204)  评论(0编辑  收藏  举报