git 常用的简单命令
git add . 会把当前目录中所有有改动的文件(不包括.gitignore中要忽略的文件)都添加到git缓冲区以待提交
git add * 会把当前目录中所有有改动的文件(包括.gitignore中要忽略的文件)都添加到git缓冲区以待提交
所以在有要忽略的文件(如:配置文件之类的)有做修改的时候
git add .可以正常工作,会把所有非忽略的所有有改动的文件添加到缓冲区
git add *则会报错,且此几命令不会添加任何文件到缓冲区
本地代码添加修改首先
(1) git add . 从本地代码文件夹添加到索引目录.
(2) git commit -m”提交描述信息” 从代码索引目录提交到HEAD目录
(3) git push 从HEAD 目录提交代码到git 服务器.
本地删除文件
(1) git add -u 把本地代码库中修改或者删除过的文件加入到索引区.
(2) git commit -m “更新信息” 从索引区加入到HEAD 区
(3) git push 把HEAD区提交到git服务器,这时服务器也会把你想删除的文件删掉.
git add -u 和 git add -a 的区别:
git add -u 只是提交你修改过的文件信息到索引区.
git add -a 把修改过的文件信息和未修改过的文件信息全部提交到索引区.
我们可以通过git add -h命令来看git add命令的帮助文档。 git add -h usage: git add [options] [--] …
-n, –dry-run dry run
-v, –verbose be verbose
-i, –interactive interactive picking
-p, –patch select hunks interactively
-e, –edit edit current diff and apply
-f, –force allow adding otherwise ignored files
-u, –update update tracked files
-N, –intent-to-add record only the fact that the path will be added later
-A, –all add changes from all tracked and untracked files
–refresh don’t add, only refresh the index
–ignore-errors just skip files which cannot be added because of errors
–ignore-missing check if – even missing – files are ignored in dry run
git push 提交时出现 warring
升级了git的版本之后,执行git push突然出现了一条警告,
内容如下: warning: push.default is unset; its implicit value is changing in Git 2.0 from ‘matching’ to ‘simple’. To squelch this messageand maintain the current behavior after the default changes, use: git config –global push.default matching To squelch this message and adopt the new behavior now, use: git config –global push.default simple See ‘git help config’ and search for ‘push.default’ for further information.(the ‘simple’ mode was introduced in Git 1.7.11. Use the similar mode ‘current’ instead of ‘simple’ if you sometimes use older versions of Git)
警告的内容是push.default没有设置。
push.default,可以设置为:nothing, matching, upstream, simple, current。
nothing:不推任何东西(要来做什么用?)。 matching:将两边名字能匹配的分支推上去。 upstream:将当前分支推到它的upstream分支。
simple:将当前分支推到它的upstream分支,但名字不匹配时拒绝。这是最安全的选项并且git 2.0之后会默认为这个。
current:将当前分支推到与它同名的分支上。
建议您进行如下设置:git config –global push.default simple。
git 常用的简单命令的更多相关文章
- 分享 | Git常用的一些命令
最近,各个项目团队已经全面从svn转向Git 近期将会分享一些Git的常用操作及使用经验: 先了解下工作中一些需要用到的命令: --------------------------- Git基本常用命 ...
- git相关的简单命令
初次使用建议看这个ppt:http://www.bootcss.com/p/git-guide/ 从现有仓库克隆 这需要用到 git clone 命令.如果你熟悉其他的 VCS 比如 Subve ...
- 关于git的一些简单命令
git简介 1 Git是什么? Git is a free and open source distributed version control system designed to handle ...
- DOS常用的简单命令
在windows下的cmd里使用 dir 列出当前目录下的文件及文件夹 md 创建目录 rd 删除目录(只能删除空目录) cd 进入指定目录 cd .. 返回上一级目录 cd / 返回到根目录 del ...
- - Git常用命令 基础 总结 MD
目录 目录 Git常用命令 帮助 help 常用操作 初始化 clone init 提交 push 暂存 更新 撤销修改 分支 branch 查看分支 创建分支 切换分支 checkout 删除分支 ...
- Git 常用命令
一.初始環境配置 git config --global user.name "John Doe"git config --global user.email johndoe@ex ...
- Git 常用命令详解
Git 是一个很强大的分布式版本管理工具,它不但适用于管理大型开源软件的源代码(如:linux kernel),管理私人的文档和源代码也有很多优势(如:wsi-lgame-pro) Git 的更多介绍 ...
- Git常用命令总结
Git常用命令总结 git init 在本地新建一个repo,进入一个项目目录,执行git init,会初始化一个repo,并在当前文件夹下创建一个.git文件夹. git clone ...
- 转收藏:Git常用命令速查表
一. Git 常用命令速查 git branch 查看本地所有分支git status 查看当前状态 git commit 提交 git branch -a 查看所有的分支git branch -r ...
随机推荐
- Mysql5.7版本编译安装及配置
配置yum安装方式 1.配置本地yum源 vim /etc/yum.repos.d/rhel-source.repo [rhel-source] name=Red Hat Enterprise Lin ...
- super用法和继承中的构造方法
当new出来一个对象的时候, this是只想对象本身. 在存在继承关系时, 在子类中用super表示引用父类中的东西. 子类的构造过程必须调用父类的构造方法. 子类中包含父类,所以子类中一定要先调用 ...
- mysql中You can't specify target table for update in FROM clause错误
原SQL delete from DEP_SYSTEM_PORTLET_SETTINGS where ID in ( select ID from DEP_SYSTEM_PORTLET_SETTING ...
- phpcms后台进入地址(包含No permission resources错误)
安装phpcms后却不知道怎么进入后台,实际上输入如下地址即可进入后台登陆界面: http://你的域名/admin.php 如果出现No permission resources.错误,可能是之前修 ...
- CentOS 6.4 搭建git 服务器
CentOS 6.4 搭建git 服务器 (2013-11-22 19:04:09)转载▼ 标签: it 分类: Linux 此文件是依据markdown所编写,更好效果参见本人github的文档ht ...
- register_shutdown_function 函数详解
设定错误和异常处理三函数 register_shutdown_function(array(‘Debug’,'fatalError’)); //定义PHP程序执行完成后执行的函数 set_error_ ...
- Java程序优化的一些最佳实践(转)
衡量程序的标准 衡量一个程序是否优质,可以从多个角度进行分析.其中,最常见的衡量标准是程序的时间复杂度.空间复杂度,以及代码的可读性.可扩展性.针对程序的时间复杂度和空间复杂度,想要优化程序代码,需要 ...
- Unity3d 制作物品平滑运动
直接贴代码了 using UnityEngine; using System; using System.Collections; using System; using DataTable; pub ...
- ePass1000 Full ActiveX Control Reference Manual Version 2.0
ePass1000 Full ActiveX Control Reference Manual Version 2.0 Error Code Value Return Status Descripti ...
- stream的seek方法实例
using (FileStream outStream = new FileStream(@"D:\12.txt", FileMode.Open)) { using (FileSt ...