git实用命令集锦
2015-07-02 09:22
260 查看
配置用户名、邮件:
$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"
忽略某些文件:(如果不管用,就放到项目根目录下)
~/.gitconfig
忽略stage步骤,直接提交:
$ git commit -a -m 'added new benchmarks'
删除文件(同时从仓库和文件系统删除):
$ git rm -f grit.gemspec
移动(或重命名)文件:
$ git mv file_from file_to
查看提交历史纪录:
$ git log --pretty=oneline
看最近两周的提交历史纪录:
$ git log --since=2.weeks
忘了提交某个文件:(下面的三条命令最终只是产生一个提交,第二个提交命令修正了第一个的提交内容)
$ git commit -m 'initial commit'
$ git add forgotten_file
$ git commit --amend
丢弃修改:
$ git checkout -- benchmarks.rb
查看当前配置有哪些远程仓库:(如果有多个远程仓库,此命令将全部列出)
$ git remote -v
创建、切换分支:
$ git branch
$ git checkout testing
新建一个bug分支,fix之后,merge到master分支,并删除改bug分支:
$ git branch iss53
$ git checkout iss53
$ vim index.html
$ git commit -a -m 'added a new footer [issue 53]'
$ git checkout master
$ git merge iss53
$ git branch -d iss53
$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"
忽略某些文件:(如果不管用,就放到项目根目录下)
~/.gitconfig
忽略stage步骤,直接提交:
$ git commit -a -m 'added new benchmarks'
删除文件(同时从仓库和文件系统删除):
$ git rm -f grit.gemspec
移动(或重命名)文件:
$ git mv file_from file_to
查看提交历史纪录:
$ git log --pretty=oneline
看最近两周的提交历史纪录:
$ git log --since=2.weeks
忘了提交某个文件:(下面的三条命令最终只是产生一个提交,第二个提交命令修正了第一个的提交内容)
$ git commit -m 'initial commit'
$ git add forgotten_file
$ git commit --amend
丢弃修改:
$ git checkout -- benchmarks.rb
查看当前配置有哪些远程仓库:(如果有多个远程仓库,此命令将全部列出)
$ git remote -v
创建、切换分支:
$ git branch
$ git checkout testing
新建一个bug分支,fix之后,merge到master分支,并删除改bug分支:
$ git branch iss53
$ git checkout iss53
$ vim index.html
$ git commit -a -m 'added a new footer [issue 53]'
$ git checkout master
$ git merge iss53
$ git branch -d iss53
相关文章推荐
- RPC failed; result=22, HTTP code = 411
- git更新已經刪除的文件
- 提取Git每次提交后Commit的文件
- GIT迁移服务器
- 分布式版本管理git入门指南使用资料汇总及文章推荐
- Git远程操作详解
- 25个 Git 进阶技巧(翻译)
- 详解版本控制利器Git,SVN的异同以及适用范围
- Ruby实现的删除已经合并的git分支脚本分享
- 在 Shell 提示符中显示 Git 分支名称的方法
- Git使用基础篇(一些常用命令和原理)
- git fork同步是什么意思?
- Python的高级Git库 Gittle
- 使用GIT进行源码管理――GUI客户端小结
- 使用git代替FTP部署代码到服务器的例子
- linux系统安装git及git常用命令
- 分享下自己总结的Git常用命令
- Git 常用命令速查表(图文+表格)
- mac git xcrun error active developer path 错误
- git报错