Welcome to MY's Blog
git 基础学习小 tip --> 初始化 git 仓库
git 基础学习小 tip --> 初始化 git 仓库
把已有的项目代码纳入 git 管理
$
cd 项目代码所在的文件夹
$
git init
新建的项目直接用 git 管理
$
cd 某个文件夹
$
git init your project
$
cd your project
咪呀示例:
$
git init git_learning
Initialized empty Git repository
in /mnt/ISO-SP1/pub/test/git_learning/.git/
$
cd git_learning/
$
ls -la
total 0
drwxr-xr-x. 3 root root 26 Oct 20 15:05
.
drwxr-xr-x. 4 root root 58 Oct 20 15:05
..
drwxr-xr-x. 7 root root 155 Oct 20 15:05 .git
$
git config --local user.name
'miya'
$
git config --local user.email
'miyacsdn@163.com'
$
git config --list --local
core.repositoryformatversion
=0
core.filemode
=true
core.bare
=false
core.logallrefupdates
=true
user.name
=miya
user.email
=miyacsdn@163.com
$ ----------------------------------------------------------------------------
$
touch readme
$
git add readme
$
git status
On branch master
No commits yet
Changes to be committed:
(use
"git rm --cached <file>..." to unstage
)
new file: readme
$
git commit -m
'Add readme'
[master
(root-commit
) 10c631c
] Add readme
1
file changed, 0 insertions
(+
), 0 deletions
(-
)
create mode 100644 readme
$
git log
commit 10c631c823838f7045a2447c3ec37cc754725d90
(HEAD -
> master
)
Author: miya
<miyacsdn@163.com
>
Date: Tue Oct 20 15:21:49 2020 +0800
Add readme