前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >git创建仓库

git创建仓库

作者头像
零月
发布2018-04-25 15:37:54
7930
发布2018-04-25 15:37:54
举报
文章被收录于专栏:从零开始的linux从零开始的linux

创建仓库

代码语言:javascript
复制
mkdir /home/gitroot
进入目录
cd /home/gitroot
初始化仓库
git init
创建一个文件
echo 123456 >> 1.txt
把1.txt添加到仓库
git add 1.txt
提交到仓库
git commit -m "add new file 1.txt"
查看状态
git status
再次修改文件
echo 111111 >> 1.txt
查看仓库状态
git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   1.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
对比仓库
git diff 1.txt 
diff --git a/1.txt b/1.txt
index f7c6dd0..1341f39 100644
--- a/1.txt
+++ b/1.txt
@@ -1 +1,2 @@
 123456
+11111
检出1.txt
git checkout -- 1.txt
再次查看状态
git status
# On branch master
nothing to commit (working directory clean)
本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2017-06-02,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 从零开始的linux 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 创建仓库
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档