git 创建仓库,提交文件
来源:互联网 发布:中国吸引外资国别数据 编辑:程序博客网 时间:2024/05/16 05:18
创建版本库
# mkdir /home/gitroot # 创建存储版本的仓库
# cd /home/gitroot/
# git init # 初始化命令,使目录变成 git 可以管理的仓库
Initialized empty Git repository in /home/gitroot/.git/
提示初始化了一个空的目录 /home/gitroot/.git,一个隐藏的 git 目录
提交文件到仓库
# vim 1.txt # 在 /home/gitroot 目录下 创建1.txt,写入多行
# git add 1.txt # 把 1.txt 增加到仓库
# git commit -m "net 1.txt" # 增加之后使用 commit 命令把文件提交到 git 仓库里面。commit: Record changes to the repository(仓库),双引号内容自定义。
NOTE: 文件必须在 /home/gitroot 自定义的仓库中,否则无法 add。
修改文件后提交
# echo "111" > 1.txt
# git status # 获取当前仓库的状态,随时可以获取,最后一次更改后,无论多久都可以。每次在修改文件之前,一定先看一下 status
# On branch master# 在 master 分支上面
# Changed but not updated:#更改,但没有更新,接下来可以提交,也可以恢复之前的状态
# (use "git add <file>..." to update what will be committed)# git add file 更新
# (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 # 查看版本更改的状态
diff --git a/1.txt b/1.txt# 两个版本,a 仓库里的文件,b 本地文件
index ec6122e..7170464 100644
--- a/1.txt
+++ b/1.txt
@@ -7,3 +7,4 @@ af
sdf
adga
+111# 提示这里有更改
# git add 1.txt # 提交文件
# git commit -m "add one line 111"# 更新到仓库
一定要 git commit -m "description" ,否则使用 git diff,或者使用 git status 依然可以查看到有更新或者更改的提示。
NOTE: 目录也是这个方法创建并上传,但是空目录无法上传到库文件,目录里面需要有文件存在。
阅读全文
0 0
- git 创建仓库,提交文件
- Git- 创建提交仓库
- 提交文件到git仓库
- git——创建仓库、提交、忽略文件、撤消更改、查看提交记录
- git创建仓库,修改和提交
- Git3.创建版本库(Git仓库)&提交更新到仓库
- 提交文件到远程仓库git
- Git入门教程(一):创建仓库、提交变更、查看提交
- git 的使用——基本的仓库创建,文件提交,上传操作命令,远程仓库关联
- git提交忽略不需要提交到远程仓库的文件
- git仓库的创建与添加文件
- git创建仓库并提交文件
- git提交远程仓库
- git提交远程仓库
- Git 提交远程仓库
- 了解并创建Git仓库,以及添加文件到仓库
- 【Git】Git创建仓库
- git 分支的 创建 修改 切换 查看 从远程仓库抓取数据 以及 提交时忽略某文件
- 浅谈Atlassian产品搭建的敏捷管理体系(二)——Confluence
- 技术部门怎么年终考核最合理?
- Linux 下查看局域网内所有主机IP和MAC
- 如何正确地看待技术合伙人
- 阿里再次打响社交网络之战?
- git 创建仓库,提交文件
- 使用Node.js制作爬虫教程
- 使用Node.js制作爬虫教程(续:爬图)
- linux配置java环境
- Node.js的开源博客系统Ghost搭建教程
- 探讨一个“无法创建JVM”的问题
- Spring Boot快速入门
- Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'empi
- Spring Boot开发Web应用