1 增加删除文件
$ git add
[file1
] [file2
] ...
$ git add
[dir
]
$ git add
.
$ git add
-p
$ git rm
[file1
] [file2
] ...
$ git rm
--cached
[file
]
$ git mv
[file
-original
] [file
-renamed
]
2 提交代码
$ git commit
-m
[message
]
$ git commit
[file1
] [file2
] ... -m
[message
]
$ git commit
-a
$ git commit
-v
$ git commit
--amend
-m
[message
]
$ git commit
--amend
[file1
] [file2
] ...
3 查看信息
$ git status
$ git log
$ git log
--stat
$ git log
-S
[keyword
]
$ git log
[tag
] HEAD
--pretty
=format
:%s
$ git log
[tag
] HEAD
--grep feature
$ git log
--follow
[file
]
$ git whatchanged
[file
]
$ git log
-p
[file
]
$ git log
-5 --pretty
--oneline
$ git shortlog
-sn
$ git blame
[file
]
$ git diff
$ git diff
--cached
[file
]
$ git diff HEAD
$ git diff
[first
-branch
]...[second
-branch
]
$ git diff
--shortstat
"@{0 day ago}"
$ git show
[commit
]
$ git show
--name
-only
[commit
]
$ git show
[commit
]:[filename
]
$ git reflog
4 撤销
$ git checkout
[file
]
$ git checkout
[commit
] [file
]
$ git checkout
.
$ git reset
[file
]
$ git reset
--hard
$ git reset
[commit
]
$ git reset
--hard
[commit
]
$ git reset
--keep
[commit
]
$ git revert
[commit
]
$ git stash
$ git stash pop
转载请注明原文地址: https://ju.6miu.com/read-665014.html