git常用命令
来源:互联网 发布:阿里云手机 编辑:程序博客网 时间:2024/06/06 06:36
git常用命令
1) 初始化git
git init
2) 使用前添加个人信息
git config --global user.name "your name"
git config --global user.email "your email"
3) 查看当前修改状态
git status
4) 增加新文件
git add filename
git add *
5) 提交记录
git commit -m "your comment" /* 针对用git-add添加过新文件的情况使用 */
git commit -a -m "your comment" /* 针对无新文件添加的情况使用 */
6) 硬恢复(恢复所有的修改)
git reset --hard 等同于 git reset --hard HEAD(见后面描述)
7) 软恢复(只恢复git索引,不改变其它任何文件修改内容和git status信息)
git reset --soft 等同于 git reset --soft HEAD(见后面描述)
8) 默认恢复 (恢复git索引和git status状态,不改变任何修改文件的内容)
git reset --mixed等同于git reset等同于git reset HEAD 等同于git reset --mixed HEAD
9) HEAD, HEAD^, HEAD^^, HEAD^<n>分别表示当前提交,倒数第二次提交,倒数第三次提交,以及倒数第n次提交
git reset --hard HEAD^
git reset --soft HEAD
10) 查看某次修改
git show HEAD等同于git show
git show HEAD^
git show HEAD^^
git show HEAD^<n>
10) 查看所有修改记录
git log
11) 克隆git
git clone src_git target_git
12) 拉分支
git branch new_branch
13) 查看分支
git branch
默认都有一个分支master
14) 切换分支
git checkout branch_name
git checkout -b new_branch 创建new_branch后切换至new_branch
15) 删除分支
git branch -d delete_branch
16) 合并分支
git merge src_branch
17) 同步clone的git仓库
git fetch origin
git merge origin/master
18) 远程git访问
git pull remote_git [local_git]
19) 更新远程git
git push remote_git current_branch
- git 常用命令
- Git常用命令
- git 常用命令
- git 常用命令
- git 常用命令
- git 常用命令
- GIT常用命令
- git 常用命令
- git 常用命令
- Git 常用命令
- git 常用命令
- Git常用命令
- Git常用命令
- git 常用命令
- Git 常用命令
- git常用命令
- git 常用命令
- Git 常用命令
- 完成端口
- sql 使用bcp进行导入导出数据
- SQL Server中count(*), count(col), count(1)的对比
- SSH框架的整合
- ASP.NET内置对象小结(1)
- git常用命令
- 手动搭建SSH框架
- [转]对九个超级程序员的采访
- c# 指定用户启动 exe
- 【JEECMS】Jeecms 报错:org.springframework.web.util.NestedServletException: Request processing failed
- 所有可执行文件变为MediaCenter打开,石化了
- .Net C#制作新版本安装包安装时系统提示“已经安装了该产品的另一个版本”
- 【面试题】求两个有序数组两两相加的值最小的K个数
- ConcurrentHashMap之实现细节