git

配置用户名

1
git config --global user.name git

配置邮箱

1
git config --global user.email git@git.com

修改git编辑器为vim

1
git config --global core.editor vim
1
git config --global core.editor vim

查看分支

1
git branch -a -av -vv

清理

1
git clean -df

-f/–force:强制删除
-d:递归目录
-n/dry-run:不删除,只显示要删除什么
修改文件

1
git mv aaa.md bbb.md

删除追踪

1
git rm aaa.md

查看远程地址

1
git remote -v

添加远程地址

1
git add origin https://github.com/dushicai/dushicai.github.io.git

删除远程地址

1
git remove origin

状态

1
git status -s -b

-s/–short:短格式
-b/–branch:分支信息
迁出分支

1
git checkout -b xxx xxx

显示.git位置

1
git rev-parse --git-dir

显示根目录位置

1
git rev-parse --show-toplevel

显示相对路劲

1
git rev-parse --show-prefix

显示当前目录cd深度

1
git rev-parse --show-cdup

存储当前改动

1
git stash

提交

1
git commit

追加提交

1
git commit --amend
Author

dushicai

Posted on

2023-05-15

Updated on

2023-06-19

Licensed under