Git 执行更改
Jerry 克隆库,他决定实现基本字符串操作。于是,他创建文件string.c,在添加内容到 string.c 会这个样子。
#include <stdio.h> int my_strlen(char *s) { char *p = s; while (*p) ++p; return (p - s); } int main(void) { int i; char *s[] = { “Git tutorials”, “Tutorials Point” }; for (i = 0; i < 2; ++i) printf(“string lenght of %s = %d/n”, s[i], my_strlen(s[i])); return 0; }
他编译和测试代码,一切工作正常。现在,他可以放心地添加这些修改到版本库。
Git 添加操作添加文件到暂存区。
[jerry@CentOS project]$ git status -s ?? string ?? string.c
[jerry@CentOS project]$ git add string.c
Git是显示文件名前的问号。显然,这些文件不属于Git,Git 不知道该怎么用这些文件。这就是为什么Git是文件名前显示问号。
Jerry 添加文件到存储区域,git的状态命令将显示文件暂存区域。
[jerry@CentOS project]$ git status -s A string.c ?? string
要提交更改他用git 的commit 命令-m选项。如果我们省略-m选项git会打开文本编辑器,在这里我们可以写多行提交信息。
[jerry@CentOS project]$ git commit -m ‘Implemented my_strlen function’
上面的命令会产生以下结果。
[master cbe1249] Implemented my_strlen function 1 files changed, 24 insertions(+), 0 deletions(-) create mode 100644 string.c
提交后查看日志信息,他使用 git 日志命令。它会显示提交ID所有提交的信息,提交作者,提交日期和提交的 SHA-1散列。
[jerry@CentOS project]$ git log
上面的命令会产生以下结果。
commit cbe1249b140dad24b2c35b15cc7e26a6f02d2277 Author: Jerry Mouse <jerry@yiibai.com> Date: Wed Sep 11 08:05:26 2013 +0530 Implemented my_strlen function commit 19ae20683fc460db7d127cf201a1429523b0e319 Author: Tom Cat <tom@yiibai.com> Date: Wed Sep 11 07:32:56 2013 +0530 Initial commit
PS:如果您想和业内技术大牛交流的话,请加qq群(521249302)或者关注微信公众 号(AskHarries),谢谢!
Git 执行更改的更多相关文章
- git 如何更改某个提交内容/如何把当前改动追加到某次commit上? git rebase
原文地址 http://www.jianshu.com/p/8d666830e826 [自己总结] 0, git diff git diff a b 是以a为基准,把b和a的区别展示出来 ...
- git执行cherry-pick时修改提交信息
git执行cherry-pick时修改提交信息 在本地分支执行cherry-pick命令时有时需要修改commit message信息,可以加参数-e实现: git cherry-pick -e co ...
- git执行pull命令时,报错
在图形界面中,执行拉取操作时,出现下面的错误. You asked to pull from the remote 'origin', but did not specifya branch. Bec ...
- git 执行pull错误如何撤销
比如你当前所在的空间是trunk,但是执行了git pull origin branches,这时需要回滚回去,可以用一下步骤: 1.运行git reflog命令查看你的历史变更记录,如下: 69fd ...
- git 撤销更改的文件
在没有git add之前: 1.撤销所有更改:git checkout . 2.撤销指定文件的更改:git checkout -- file.txt git add之后: git reset HEAD ...
- git 仓库迁移,git remote 更改源
git仓库迁移 我们有时候需要迁移git仓库,但又想保留每次commit的记录,所以我们只需要更改git remote [源]的问题即可 首先查看你的remote的地址 git remote -vv ...
- Git 提交更改
Jerry 已经提交的更改,他想纠正他的最后一次提交,在这种情况下,git 的修改将帮助操作.最后提交修改操作的变化,包括提交信息,它创建新的提交ID. 修改操作之前,他会检查提交日志. [jerry ...
- Git 查看更改
当向仓库中添加文件或删除文件后,可能需要查看更改. 查看更改有多种方式. 1.查看状态 # git status 结果 1 2 # 位于分支 master 无文件要提交,干净的工作区 2.查看日志 # ...
- Git执行"git rebase -i HEAD~xxx"报错:git rebase fatal: Needed a single revision invalid upstream –i
一.问题"git rebase -i HEAD~xxx"是修改git 历史记录的一个很有用的命令. 但是有时在执行该命令时会出现以下错误:$ git rebase –i HEAD~ ...
随机推荐
- rxjs 简单的demo
开发环境是使用 create-react-app 创建的.再使用 $ cnpm install rxjs 来安装即可开始. $ npx create-react-app my-app $ cd my- ...
- Android Studio开发-高效插件强烈推荐
Android Studio开发-高效插件强烈推荐 现在Android的开发者基本上都使用Android Studio进行开发(如果你还在使用eclipse那也行,毕竟你乐意怎么样都行).使用好And ...
- C# delegate 委托
http://www.runoob.com/csharp/csharp-delegate.html
- 如何获取 XAML 控件的模板代码
有时候 .NET 自带提供的控件并不能满足我们的实际需求,需要进行修改,或者参考代码来建立新的控件. 可以在编辑器的文档大纲窗口中,找到所需的对象,然后在其上点右键,编辑模板,编辑副本 弹出创建 St ...
- 用“网建”平台发手机短信的C#代码
一直都用这个平台发手机短信的,今天做新项目的时候用到了,但是上来博客搜索不到,只好翻以前的源代码翻了好久才找到了,先记下来,以作备用: using System; using System.Colle ...
- lua -- debug
framework.debug 调试支持 ~~ echo 功能同 print. 格式: echo(值, [值, 值, ...]) ~~ printf 按照特定格式输出. 格式: printf(格式字符 ...
- HHH
https://data-artisans.com/flink-forward/resources/alibabas-common-algorithm-platform-on-flink https: ...
- angular的uiRouter服务学习(3)
本篇接着上一篇 angular的uiRouter服务学习(2) 继续讲解uiRouter的用法 本篇主要讲解uiRouter的多个命名的视图 我们可以给ui-view元素添加ui-view的值来给它命 ...
- angular的uiRouter服务学习(1)
angular有内置的路由服务$route:angular -- $route API翻译 使用$route可以帮助实现路由的切换,视图的改变,但是这个内置的$route只包含了基本的功能,在很多场合 ...
- [Windows Azure] How to Monitor Cloud Services
How to Monitor Cloud Services To use this feature and other new Windows Azure capabilities, sign up ...