Git常用命令
来源:互联网 发布:网络控制器是干嘛的 编辑:程序博客网 时间:2024/05/16 10:19
总结了一些在工作中频繁用到的Git命令,基本上可以满足需求;
Git其实很简单,能用即可。
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
(2) git commit
$ git add *$ git add LICENSE$ git commit -m "Initial Commit"
(3) git remote
$ git remoteorigin
$ git remote -vorigin 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
(4) git push
$ git pushUsername for 'https://github.com': KeleirPassword 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 -> master
8.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 behindhint: 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
热门推荐
LNMP环境搭建——Nginx篇
在RHEL6.5中配置本地YUM源
Ubuntu下Zabbix安装及使用问题
MySQL双主热备问题处理
Rsync同步错误处理
Fix Elementary Boot Screen (plymouth)
After Installing Nvidia Drivers- LNMP环境搭建——MySQL篇
- Shell Step by Step (3) —— Stdin & if
- Shell Step by Step (4) —— Cron & Echo
- LNMP环境搭建——PHP篇
0 0
- git 常用命令
- Git常用命令
- git 常用命令
- git 常用命令
- git 常用命令
- git 常用命令
- GIT常用命令
- git 常用命令
- git 常用命令
- Git 常用命令
- git 常用命令
- Git常用命令
- Git常用命令
- git 常用命令
- Git 常用命令
- git常用命令
- git 常用命令
- Git 常用命令
- ASP.NET MVC 3 初认知
- [Leetcode]Search Insert Position
- CTSFail解决办法 android.webkit.cts.WebSettingsTesttestUserAgentString_default 和libcore.java.net.URLfail
- 一些容易被忽视的linux命令(二)
- RobotFramework+SSHLibrary实现远程执行Linux命令
- Git常用命令
- git 目录
- OAF开发基本知识点
- C++Primer第五版 练习11.4(解答)
- fork() vfork() return退出与exit退出 http://blog.chinaunix.net/uid-24261911-id-2620651.html
- 1008 Fractal (2015年北京赛区网络赛G题)
- Android开源工具库
- hdu 4349 Xiao Ming's Hope(C(n,m)的奇偶性)
- UI24_NSUserDefaults