windows下创建本地git仓库
Posted ITlsy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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仓库的主要内容,如果未能解决你的问题,请参考以下文章