Git经常使用命令
2017-06-14 12:16
218 查看
总结了一些在工作中频繁用到的Git命令,基本上能够满足需求。
Git事实上非常easy,能用就可以。
1.比較提交 - Git Diff
$ git diff master..test $ git diff master...test
2.克隆项目 - Git Clone
$ git clone http://git.shiyanlou.com/shiyanlou/gitproject $ git clone /home/shiyanlou/gitproject myrepo
3.提交改动 - Git Add
$ git add newfile $ git add -u
这个命令的意思是
add to index only files modified or deleted and not those created
仅仅会处理已改动或者已删除的文件。可是不会处理新建的文件
$ git commit -m "add"
4.合并分支 - Git Pull
$ git pull /home/shiyanlou/myrepo master
5.查看改动 - Git Log
$ git log -p master..myrepo/master
6.全局配置 - Git Config
git config --global user.email "keleix@gmail.com" git config --global user.name "Kallen"
7.完整使用流程
(1) git init
$ git init $ git pull https://github.com/keleir/BlogProj.git[/code](2) git commit
$ git add * $ git add LICENSE $ git commit -m "Initial Commit"(3) git remote
$ git remote origin$ git remote -v origin https://github.com/Keleir/BlogProj.git (fetch) origin https://github.com/Keleir/BlogProj.ssgit (push)$ git remote add origin https://github.com/Keleir/BlogProj.git[/code](4) git push
$ git push Username for 'https://github.com': Keleir Password for 'https://Keleir@github.com': Counting objects: 15, done. Delta compression using up to 2 threads. Compressing objects: 100% (7/7), done. Writing objects: 100% (8/8), 1.50 KiB | 0 bytes/s, done. Total 8 (delta 6), reused 0 (delta 0) To https://github.com/Keleir/BlogProj.git 47688f3..e22a55b master -> master8.FAQ
(1) git push出错
failed to push some refs to 'https://github.com/Keleir/Arigue.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again.
【解决的方法】git pull origin master git push -u origin master -f
相关文章推荐
- git经常使用命令和问题
- Git 经常使用命令总结
- 理解git经常使用命令原理
- Git经常使用命令
- Git 基本原理与经常使用命令
- Git 经常使用的命令
- Git flow的分支模型与及经常使用命令简单介绍
- git的经常使用的命令与svn类比
- 在工作中经常使用的git命令笔记
- git 经常使用的命令
- Git 经常使用命令合集
- Git经常使用命令
- Git 经常使用的命令
- Git高速入门——Git安装、创建版本号库以及经常使用命令
- git和github经常使用的命令集合
- Git经常使用命令总结
- Git经常使用的命令
- Git经常使用的命令,也就那么几个
- git的经常使用命令
- 最简洁高效的Git 命令上传代码【以及Git的一些经常使用的小命令】