Git工具本地管理总结

一、本地仓库创建
https://blog.csdn.net/heshuangzong/article/details/125882372
https://blog.csdn.net/l7077/article/details/130270914
在本地创建/home/test目录,作为本地仓库目录。

$ mkdir /home/test
$ cd /home/test

初始化本地的git 仓库。

$ git init
Initialized empty Git repository in /home/remote/test/.git/
在仓库下创建一个test.c空文件,然后git status查看状态。
$ touch test.c
$ git status
On branch master
No commits yet
Untracked files:
(use “git add …” to include in what will be committed)
test.c
nothing added to commit but untracked files present (use “git add” to track)

二、
1、添加当前目录下的所有文件到暂存区:git add .
2、添加一个或多个文件到暂存区:git add [file1] [file2] ...
3、回退一个或者多个修改
丢弃工作区的改动:git checkout -- <文件>

三、提交暂存区到本地仓库中: git commit -m [message]
-m, 使用-m选项以在命令行中提供提交注释。[message] 可以是一些备注信息。

四、git查看文件

猜你喜欢

转载自blog.csdn.net/a1809032425/article/details/132735205