git 命令总结

常用的git命令

git remote -v 查看git目录

git clone 克隆(默认master,注意切换分支)

git commit -m ‘备注’

git commit -a = git add  git commit

git push

git status 查看状态

git status -s 简易版

git mv file_name new_file_name    重命名

git log

git log - p -2 最近2次提交的详情

git log -U1 —word-diff

git log —stat 简要信息

git log —pretty=oneline(short,full,fuller)

git reflog  查看所有分支的所有操作记录

git diff 查看文件差异 为暂存

git diff —cached   查看文件差异     已暂存

git mv file_from file_to 文件改名

git log -p(显示内容差异) -2(最近2次) --stat(简略信息) 提交历史

git checkout --file 覆盖本地文件

git branch -a 查看分支

git checkout develop 切换分支   

git branch   查看分支

git branch name 创建分支

git checkout -b name  创建+切换分支

git branch -d name 删除分支

git merge origin/master   合并

合并失败

$:git merge --abort

$:git reset --merge

$:git pull

git pull 冲突解决

1.git stash 备份当前工作区,从最近一次提交总读取内容

git pull 

git stash pop 回复工作区

git stash list

2.放弃本地修改,直接覆盖

git reset —hard

git pull

猜你喜欢

转载自blog.csdn.net/u012717420/article/details/82113827
今日推荐