Git的使用

导读:本篇文章讲解 Git的使用,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com

git简介:

Git 是一个免费和开源的 分布式版本控制系统,旨在以速度和效率处理从小型到大型项目的所有 内容。Git易于学习, 占用空间小,性能快如闪电。
idea整合git,使用idea进行项目代码同步操作

下载:

git官网:https://git-scm.com/download/win
在这里插入图片描述

安装:

选择软件安装路径,然后全部下一步即可。

使用步骤:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

只有配置好身份信息之后,才能提交

在这里插入图片描述

git config --list  查看配置(然后才能配置)
git config --global  user.email '邮箱地址'  配置邮箱信息(与团队其他人交互时显示这些信息)
git config --global user.name '随便名称'  配置用户名称
git commit -m '提交备注' 提交备注(配置邮箱和用户,才能提交备注)
33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=D:/软件&安装包/软件/Git/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git config --global user.email '3315489188@qq.com'

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git config --global user.name 'xiaoyatou'

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=D:/软件&安装包/软件/Git/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
user.email=3315489188@qq.com
user.name=xiaoyatou
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ 

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

代码如下:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

33154@DESKTOP-P7025DP MINGW64 /d/mygit
$ pwd
/d/mygit

33154@DESKTOP-P7025DP MINGW64 /d/mygit
$ ll
total 0

33154@DESKTOP-P7025DP MINGW64 /d/mygit
$ git init
Initialized empty Git repository in D:/mygit/.git/

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git status
On branch master

No commits yet

nothing to commit (create/copy files and use "git add" to track)

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ touch test1.txt

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git status
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        test1.txt

nothing added to commit but untracked files present (use "git add" to track)

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git add test1.txt

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   test1.txt


33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git commit test1.txt -m '第一次提交'

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got '33154@DESKTOP-P7025DP.(none)')

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git config --global user.email'3315489188@qq.com'

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git config --global user.name'xiaoyatou'

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=D:/软件&安装包/软件/Git/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git config --global user.email '3315489188@qq.com'

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git config --global user.name 'xiaoyatou'

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=D:/软件&安装包/软件/Git/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
user.email=3315489188@qq.com
user.name=xiaoyatou
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ ^C

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ ^C

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git commit test1.txt -m '第一次提交'
[master (root-commit) 34d760b] 第一次提交
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 test1.txt

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git ls-tree master
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391    test1.txt

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git show e69de29

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git reflog
34d760b (HEAD -> master) HEAD@{0}: commit (initial): 第一次提交

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git ls-tree master
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391    test1.txt

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git show e69de29bb2

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   test1.txt

no changes added to commit (use "git add" and/or "git commit -a")

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git commit test1.txt -m '第二次提交'
[master ed3912c] 第二次提交
 1 file changed, 1 insertion(+)

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git status
On branch master
nothing to commit, working tree clean

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git ls-tree master
100644 blob b524eefd532d387b1496422c33b01e19ceb59146    test1.txt

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$ git show b524eefd
xiaoyatou

33154@DESKTOP-P7025DP MINGW64 /d/mygit (master)
$

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/118040.html

(0)
seven_的头像seven_bm

相关推荐

发表回复

登录后才能评论
极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!