git常用命令
2015-10-14 01:27
369 查看
添加远程仓库
git remote add origin <url ssh or https>
建立本地分支与远程的关系
git branch --set-upstream master origin/master
查看状态
git status
查看当前分支
git branch
查看修改
git diff <file> gti diff HEAD --<fiel>
查看日志
git log
版本回退
git reset --hard HEAD^ or commit id
记录每一次命令
git reflog
撤销修改(工作区与版本区的修改)
git checkout -- <file>
撤销暂存区(把提交到暂存区的修改返回到工作区 如果需要彻底的撤销修改 就用git checkout – 命令)
git reset HEAD <file>
删除文件
git rm <file> git commit
删除文件夹
git rm <dir> -r git commit
误删除文件恢复
git checkout -- <file>
创建分支
git branch <name>
切换分支
git checkout <name>
创建分支并切换
git checkout -d <name>
相关文章推荐
- 找电影资源最强攻略,知道这些你就牛B了!
- Android_程序锁
- HTML5表单元素和表单属性
- hdoj 2044 一只小蜜蜂... C++
- HDOJ 2191 珍惜现在,感恩生活 【动态规划 多重背包】
- git
- POJ 3083 Children of the Candy Corn
- Nginx负载均衡器让后端RS记录真实IP
- 分布式系统的难点
- 关于windowsAPI录音
- 推拉模型
- IOC容器中Bean的生命周期方法
- android-UI组件实例大全(一)------TextView文本框
- Effective Java
- ngnix 配置错误页面
- windows录音程序原理
- 数据库分析与设计总结
- 分布式事务
- android view类的xml属性
- 使用键盘来改变形状中的线条样式,或移动鼠标来创建一个新的形状