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 ...
随机推荐
- 3-python学习——变量
变量是我所接触过的编程语言中都具有的一个概念,只是这个概念有的强有的弱罢了. 1.什么是python的变量 变量这个东西怎么解释呢?不怎么好说. 这么说吧,变量就相当于一个代名词,或者说是名字. 计算 ...
- Android俄罗斯方块AI设计文档
首先上源码: https://github.com/bingghost/SimpleTetris 一.概要 使用了2种AI算法: 一种是经典的Pierre Dellacherie算法 一种基于基于深度 ...
- oracle数据库两表数据比较
本文转自http://blog.sina.com.cn/s/blog_3ff4e1ad0100tdl2.html 1 引言 在程序设计的过程中,往往会遇到两个记录集的比较.如华东电网PMS接口中实现传 ...
- 全局对象的构造函数会在main 函数之前执行
#include <iostream> using namespace std; class A { public: A() { cout << "Generator ...
- poj 1847( floyd && spfa )
http://poj.org/problem?id=1847 一个水题,用来熟悉熟悉spfa和floyd的. 题意:有m条的铁路,要从x,到y, 之后分别就是条铁路与其他铁路的交点.第一个输入的为有n ...
- Python之多线程
廖雪峰教程--- http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/00138683 ...
- mysql 安装和卸载
1.1 上次课内容回顾: MVC案例: * Servlet * 处理请求. * JSP * 显示数据 * JSTL+EL显示数据. * JavaBean * 封装和处理数据 * BeanUtils封装 ...
- codeforces 495B. Modular Equations 解题报告
题目链接:http://codeforces.com/problemset/problem/495/B 题目意思:给出两个非负整数a,b,求出符合这个等式 的所有x,并输出 x 的数量,如果 ...
- spfa(模板)
spfa作为图论中的常用算法,深受各类出题人和各位OIer的喜爱: so,为了给大众创造福利,宝宝在此奉上spfa大发的思路和模板:以感谢社会, 感谢CCF,感谢CCTV, 感谢我的老师,感谢同学们, ...
- linq lanbda表达式的用法
1. 查询Student表中的所有记录的Sname.Ssex和Class列.select sname,ssex,class from studentLinq: from s in Student ...