git使用
来源:互联网 发布:淘宝网排行榜从哪里进 编辑:程序博客网 时间:2024/05/17 23:25
别名配置
在用户目录下修改.gitconfig文件:
[user]email = youremail@mail.comname = yourname[color]diff = autostatus = autobranch = auto[alias]co = checkoutct = commitdf = diffbr = branchst = statusdfh = diffhist = log --pretty=format:\"%h %ad|%s%d[%an]\" --graph --date=short
基本使用实例
初始化仓库并提交
mkdir demo
创建目录
git init
初始化仓库
echo "hello" >> a.txt
新建文件
git add .
添加到缓冲区
git commit -m "commit1"
提交
echo "new line" >> a.txt
修改文件
git commit -m "commit2"
直接提交(失败)
git commit -a -m "commit3"
不建议使用
撤销本地修改及暂存区修改
echo "third line" >> a.txt
新添加一行
git diff
查看本地与暂存区差异
git diff head
比较本地与仓库差异
git checkout .
用暂存区覆盖本地
echo "third line again" >>a.txt
重新修改
git add a.txt
添加到暂存区
echo "modify" >> a.txt
再添加一个修改
git reset head
将加入到暂存区的回滚,此时暂存区与head相同
git checkout
实现整个回滚
创建及切换分支
git branch
列出所有分支
git branch dev
创建dev分支
git branch
查看是否已经创建分支成功
git checkout dev
切换到dev分支
git stash
暂存当前进度,当区工作不想提交又要切换时就可以这么干;执行完命令后,本地是head的拷贝;
git stash pop
要使用暂存内容时,即可回到之前的状态
0 0
- 【git】VS2015使用Git
- 【GIT】 git rebase 使用
- 【Git】Git客户端使用
- 使用git
- git使用
- Git使用
- Git使用
- git 使用
- Git使用
- git使用
- git使用
- git 使用
- git 使用
- git 使用
- git 使用
- git 使用
- Git使用
- git 使用
- thickbox跨越frameset
- 外部IP的Windows通知服务(External IP Windows Notification Service)
- JVM字节码指令集简介
- 三角型
- HDOJ 题目1518 Square(dfs)
- git使用
- PAT1038. Recover the Smallest Number (30)
- My Threat Intelligence and Threat Assessment Research Papers Publish
- poj2082 Terrible Sets 单调栈
- UVA - 270 Lining Up 数据优化
- Nordic iBeacon设备在ios8上无法正常工作的问题
- MYSQL的一知半解
- 【Java】解决Acces restriction: The type X is not accessible due to restriction on required library 的解决方法
- Codeforces 480D Parcels(dp)