高效使用git的一些命令
1,添加文件到版本库
添加单个文件: git add filename
添加所有txt文件: git add *.txt
添加所有修改文件: git add .
2,提交
提交所有修改: git commit -m "commit msg" -a
提交单个修改: git commit -m "commit msg" filename
修改commit信息: git commit --amend
3,撤销修改
撤销尚未提交的修改: git checkout 1.txt 2.txt
撤销提交: git revert head(反转提交,撤销最近一次的提交并且会产生一个新的commit信息)
复位: git reset HEAD filename(取消暂停)
git reset --hard HEAD^(撤销)
4,分支
列出本地分支: git branch
列出所有分支: git branch -a
基于当前分支创建新分支: git branch branchcname
切换分支: git checkout branchname
基于当前分支创建新的分支并且切换到新的分支: git checkout -b branchname
基于某次提交,分支或者tag创建分支: git branch branchname bf357de
git branch branchname tagname
5,合并
普通合并: git merge branchname
挑选合并: git cherry-pick bf357de
压缩合并: git merge --squash branchname
其它: git rebase branchname
reabse: git rebase -i
6,删除分支
git branch -d branchname
git branch -D branchname(强制删除分支)
7,查看状态
git log --oneline --graph
gitk 查看当前分支历史
gitk branchname 查看特定分支历史
gitk -all 查看所有分支历史
gitk filename 查看某文件的历史记录
8,remote
git clone
git pull origin branchname
git push origin branchname
git push origin tagname
9,config
生成ssh密钥: ssh-keygen.exe -t rsa
配置邮箱: git config --global user.email *****.com
配置用户名: git config --global user.name your-id
最新文章
- mongodb
- 我人生中的jQuery选择器
- 使用DateUtils和DateFormatUtils处理时间日期转换与SimpleDateFormat的区别
- MySQL数据库学习笔记(三)----基本的SQL语句
- std::shared_ptr
- UINavigationController 子控制器管理原理
- sudo gem install cocoapods
- 51nod 博弈论水题
- ng-click得到当前元素,angular.element()用法
- SQL ;Server ;2008 ;R2 ;跟踪标志
- YoMail 邮箱客户端的社会化之路,起于邮箱,不止于邮件
- webapp万能选择器:iosselect
- Android studio java.lang.UnsatisfiedLinkError
- Asp.Net Core 轻松学-多线程之Task快速上手
- 如何量化考核技术人的KPI?
- 在jsp里面 当鼠标元素触发onmouseover时,旁边出现一个浮动且跟随鼠标的div ,移开消失
- 潭州课堂25班:Ph201805201 django框架 第一课 环境搭建 (课堂笔记)
- MDIEMDIE双心封装版0.3.0.0RC6V2
- UI型Bug定义的处理方法
- 第11课 enum,sizeof,typedef分析
热门文章
- diff: /../Podfile.lock: No such file or directory
- 如何抛出未认证(Unauthorized=401)异常代码
- 小白学习mysql之索引初步
- CSS 居中大全(转)
- 开源搜索 Iveely Search Engine 0.6.0 发布 -- 黎明前的娇嫩
- 开源搜索引擎Iveely 0.7.0发布,不一样,那就让他不一样!
- redis学习笔记——(2)
- 编写高质量代码改善C#程序的157个建议[泛型集合、选择集合、集合的安全]
- jQuery使用之(二)设置元素的样式
- 第三章:javascript: 列表