1. git status 查看当前代码是出于什么状态,是否有需要的代码需要提交。
2. git branch -a 查看当前远程分支
3. git branch 查看本地分支
4. git branch -v v 查看本地建立的分支于远程分支的关联。
5. git branch -v 查看远程分支别名及对应的远程分支目录
6. git checkout -d xxx 删除当前的xxx分支
7. git checkout -b local_xxx_name remote_branch 建立并切换到本地分支local_xxx_name
8. git checkout xxx 切换到分支xxx,若是更新最新的代码可以是git checkout filename
9. git log --oneline -10 查看最新git中改的活动
10. git add . 添加本地修改的所有文件,若是增加某个文件,则采用git add xxx_file_name
11. git commit -s -m "xxx_xxx_xxx" 上传到本地库,“”中的内容主要是注释作用
12. git log --author=authorname 查看某个人修改的活动
13. git commit --amend
撤销上一次提交
14. git branch -D branch-name 强制删除分支
15.
git reset HEAD <file>
撤销已经被暂存(git add)的文件
git reset --soft: 撤销并回退 commit, 不影响 index file, 撤销到哪个位置由最后一个参数指定. git reset --soft HEAD^
git reset --hard: 撤销 commit, index file and workspace
git reset --mixed: 默认选项, 撤销 commit and index file, 只保留workspace.
git reset --: 删除登记在 index file 里的某个文件
16. git count-objects -v 查看占用空间大小
17. git checkout -f 恢复删除文件