风流不在谈锋胜,袖手无言味最长。这篇文章主要讲述windows下创建本地git仓库相关的知识,希望能为你提供帮助。
有些时候自己新建的一些工程并不太愿意上传到git服务器,而又想做到可以版本回退,那么创建本地git仓库是很好的办法。
1.在自己的项目目录,初始化本地仓库
lsyai@Eleven MINGW64 /e/QtPro/test/test_local_git
$ git init
Initialized empty Git repository in E:/QtPro/test/test_local_git/.git/
2.使用add命令,增加本地文件
lsyai@Eleven MINGW64 /e/QtPro/test/test_local_git (master)
$ git add *
3.使用commit提交增加的文件并写提交日志
lsyai@Eleven MINGW64 /e/QtPro/test/test_local_git (master)
$ git commit -m "first"
[master (root-commit) 7af35de] first
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 1.txt
create mode 100644 2.txt
4.查看提交状态
lsyai@Eleven MINGW64 /e/QtPro/test/test_local_git (master)
$ git status
On branch master
nothing to commit, working tree clean
5.修改本地文件,检测是否可以看到变动
lsyai@Eleven MINGW64 /e/QtPro/test/test_local_git (master)
$ git status
On branch master
Changes not staged for commit:
(use "git add < file> ..." to update what will be committed)
(use "git restore < file> ..." to discard changes in working directory)
modified:1.txt
Untracked files:
(use "git add < file> ..." to include in what will be committed)
23.txt
no changes added to commit (use "git add" and/or "git commit -a")
6.再次提交,并查看提交日志
$ git add *
lsyai@Eleven MINGW64 /e/QtPro/test/test_local_git (master)
$ git commit -m "seconde"
[master 0562316] seconde
2 files changed, 1 insertion(+)
create mode 100644 23.txt
$ git log
commit 05623169a180dbe8f97b3faeb76d9b4f4ec51550 (HEAD -> master)
Author: Liu-Eleven < 1024847801@qq.com>
Date:Sat Mar 12 08:46:52 2022 +0800
seconde
commit 7af35dea0c131207b73efb81a7b2b0290332c2d4
Author: Liu-Eleven < 1024847801@qq.com>
Date:Sat Mar 12 08:45:44 2022 +0800
first
7.查看具体的提交信息
$ git show 05623169a180dbe8f97b3faeb76d9b4f4ec51550
commit 05623169a180dbe8f97b3faeb76d9b4f4ec51550 (HEAD -> master)
Author: Liu-Eleven < 1024847801@qq.com>
Date:Sat Mar 12 08:46:52 2022 +0800
seconde
diff --git a/1.txt b/1.txt
index e69de29..48ff06b 100644
--- a/1.txt
+++ b/1.txt
@@ -0,0 +1 @@
+2312334
\\ No newline at end of file
diff --git a/23.txt b/23.txt
new file mode 100644
index 0000000..e69de29
【windows下创建本地git仓库】
推荐阅读
- Java架构师必须知道的JVM类加载机制,这都不懂趁早放弃吧!
- Tomcat的优化及OOM问题
- 如何用C/C++实现去除字符串头和尾指定的字符
- 因为实现不了Promise.all,一场面试凉凉了
- RocketMQ集群部署
- 有奖调研 | 即时消息服务的产品需求规划就交给你了!
- 面试官问你 JVM,你知道加分项在哪吗()
- 一行Python代码,给PDF文件添加水印,快速而且免费~python-office自动化办公,YYDS
- Sublime快捷键设置