Git 常用命令方法整理

1、查看所有分支

git branch -av

2、切换分支

git checkout branch_name

3、新建分支并指向服务器主线

git checkout -b branch_name server_branch_name

4、删除一个分支

git 
branch -D branch_name

5、查看远程分支状态

git remote -v

6、把本地 所有更改(或单个更改)替换为服务器版本

git checkout .(或单个路径)

7、修改已提交注释

git commit --amend

8、撤回本地提交(慎用)

git reset HEAD~[number]

9、查看某个文件的修改历史

git log --pretty=oneline 文件名(含路径)

10、显示具体的某次改动

git show 哈希值


本文链接:http://blog.csdn.net/lechengyuyuan/article/details/40345243

你可能感兴趣的:(git)