git 常用命令记录

这里记录一些使用过的Git命令。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

git checkout -b 本地分支名x origin/远程分支名x
git fetch origin 远程分支名x:本地分支名x
git reset --hard
git push -f

git log --graph --decorate --oneline --simplify-by-decoration --all
git log --oneline --graph --decorate --all
git log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

git config --global alias.lg "log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"

#忽略跟踪
git update-index --assume-unchanged [file]

#恢复跟踪
git update-index --no-assume-unchanged [file]


查看本地仓库哪些文件被加入忽略列表
git ls-files -v