git
2020-08-14 22:46:20 0 举报
AI智能生成
为你推荐
查看更多
git
作者其他创作
大纲/内容
git
git config
设置名字和邮箱
git config user.name \"Jon\"git config user.email \"jon@test.com\"
选项
--global
用户配置
--system
系统配置
--file
当前库配置
--unset
移除配置
git config --unset --global user.email
配置别名
git config --global alias.show-graph \\'log --graph --abbrev-commit --pretty=oneline'
基本概念
版本库 .git
对象库 object store
块 blob
文件的每一个版本表示为一个块
目录树 tree
代表目录
提交 commit
代表一次提交
标签 tag
给一个其他对象的别名
索引 index
描述整个版本库的目录结构,存在于本地做文件名和blob的映射,目录名和tree的映射,tag和对象的映射
可寻址内容名称
git追踪内容
git命令
子命令
add
说明
添加文件到git库,git add .会把当前目录及子目录都添加到子目录
am
Apply a series of patches from a mailbox
archive
Create an archive of files from a named tree
bisect
Use binary search to find the commit that introduced a bug
branch
bundle
Move objects and refs by archive
checkout
Switch branches or restore working tree files
cherry-pick
Apply the changes introduced by some existing commits
citool
Graphical alternative to git-commit
clean
Remove untracked files from the working tree
clone
Clone a repository into a new directory
commit
提交变更到版本库
--amend
--message
describe
Give an object a human readable name based on an available ref
diff
fetch
Download objects and refs from another repository
format-patch
Prepare patches for e-mail submission
gc
Cleanup unnecessary files and optimize the local repository
gitk
The Git repository browser
grep
Print lines matching a pattern
gui
A portable graphical interface to Git
init
Create an empty Git repository or reinitialize an existing one
log
查看提交日志
merge
Join two or more development histories together
mv
移动或重命名
notes
Add or inspect object notes
pull
Fetch from and integrate with another repository or a local branch
push
Update remote refs along with associated objects
range-diff
Compare two commit ranges (e.g. two versions of a branch)
rebase
Reapply commits on top of another base tip
reset
Reset current HEAD to the specified state
restore
Restore working tree files
revert
Revert some existing commits
rm
Remove files from the working tree and from the index
shortlog
Summarize 'git log' output
show
显示提交详情
stash
Stash the changes in a dirty working directory away
status
Show the working tree status
submodule
switch
Switch branches
--version
--git-dir
其他说明
选项可简写,例如:git commit --message=\"test\" 等价于 git commit -m=\"test\"
和子命令间的-可写可不写,例如:git commit 等价于 git-commit
可以通过双破折号来分离参数
配置文件
.git/config
优先级最高,可用--file选项修改
~/.gitconfig
用户配置,可用--global选项修改
/etc/gitconfig
系统配置,可用--system选项修改(需要有权限)
收藏
收藏
0 条评论
回复 删除
下一页