91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

代碼版本控制Git工具使用詳解

發布時間:2020-07-01 19:45:28 來源:網絡 閱讀:3147 作者:IT技術棧 欄目:開發技術

一、Git簡介

  • Git是一個開源的分布式版本控制系統,用于敏捷高效地處理任何或小或大的項目。
  • Git 是 Linus Torvalds 為了幫助管理 Linux 內核開發而開發的一個開放源碼的版本控制軟件。
  • Git 與常用的版本控制工具 CVS, Subversion 等不同,它采用了分布式版本庫的方式,不必服務器端軟件支持。

二、Git安裝

1.centos7安裝Git

[root@server-1 ~]# yum install -y git 

2.查看安裝的Git版本

[root@server-1 ~]# git --version
git version 1.8.3.1

3.創建git安裝目錄并初始化

[root@server-1 ~]# mkdir /data/git/
[root@server-1 ~]# cd /data/git/
[root@server-1 git]# git init 
Initialized empty Git repository in /data/git/.git/

初始化后在該目錄下會生成.git隱藏目錄

[root@server-1 git]# ls -la
total 0
drwxr-xr-x. 3 root root  18 Apr  8 09:07 .
drwxr-xr-x. 5 root root  45 Apr  8 09:05 ..
drwxr-xr-x. 7 root root 119 Apr  8 09:07 .git
[root@server-1 git]# ls .git/
branches  config  description  HEAD  hooks  info  objects  refs

4.新建一個test.txt測試文件

[root@server-1 git]# vim test.txt

123abc

把本地test.txt文件添加到git倉庫

[root@server-1 git]# git add test.txt

add后必須執行commit才能真正把文件提交到git倉庫里

[root@server-1 git]# git commit -m "add new file test.txt"

*** 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 'root@server-1.(none)')

修改test.txt

[root@server-1 git]# vim test.txt 

123abc
456789
[root@server-1 git]# git add test.txt
[root@server-1 git]# git commit -m "add new file test.txt"

*** 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 'root@server-1.(none)')

報錯信息fatal: unable to auto-detect email address (got 'root@server-1.(none)')解決辦法

編輯vi .git/config ,添加如下參數

[user]
 email = root@server-1
 name = server-1

報錯解決

再次添加和提交test.txt文件

[root@server-1 git]# git add test.txt
[root@server-1 git]# git commit -m "add new file test.txt"
[master (root-commit) 66455b2] add new file test.txt
 1 file changed, 2 insertions(+)
 create mode 100644 test.txt

查看當前倉庫中的狀態是否有改動的文件

[root@server-1 git]# git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   .test.txt.swp
nothing added to commit but untracked files present (use "git add" to track)

5.查看倉庫里面文件版本更新的東西

[root@server-1 git]# git add test.txt
[root@server-1 git]# git commit -m "add new file test.txt"
[master 2654728] add new file test.txt
 1 file changed, 3 insertions(+)
[root@server-1 git]# git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   .test.txt.swp
nothing added to commit but untracked files present (use "git add" to track)
[root@server-1 git]# git log
commit 26547288f6ad9e70ab842b4848febc6d4ddeb5aa
Author: server-1 <root@server-1>
Date:   Sun Apr 8 11:44:27 2018 +0800

    add new file test.txt

commit 66455b2eaeb1bde8f76b54626d290ac814642723
Author: server-1 <root@server-1>
Date:   Sun Apr 8 10:09:53 2018 +0800

    add new file test.txt
        [root@server-1 git]# git log
commit 26547288f6ad9e70ab842b4848febc6d4ddeb5aa
Author: server-1 <root@server-1>
Date:   Sun Apr 8 11:44:27 2018 +0800

    add new file test.txt

commit 66455b2eaeb1bde8f76b54626d290ac814642723
Author: server-1 <root@server-1>
Date:   Sun Apr 8 10:09:53 2018 +0800

    add new file test.txt
[root@server-1 git]# ^C
[root@server-1 git]# git log
commit 26547288f6ad9e70ab842b4848febc6d4ddeb5aa
Author: server-1 <root@server-1>
Date:   Sun Apr 8 11:44:27 2018 +0800

    add new file test.txt

commit 66455b2eaeb1bde8f76b54626d290ac814642723
Author: server-1 <root@server-1>
Date:   Sun Apr 8 10:09:53 2018 +0800

    add new file test.txt

查看單行顯示日志

[root@server-1 git]# git log --pretty=oneline 
26547288f6ad9e70ab842b4848febc6d4ddeb5aa add new file test.txt
66455b2eaeb1bde8f76b54626d290ac814642723 add new file test.txt

6.回退版本,撤銷已修改的版本

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

天镇县| 东至县| 永州市| 浑源县| 禹城市| 建平县| 德保县| 松阳县| 曲麻莱县| 遂宁市| 闽侯县| 永吉县| 江津市| 孟村| 清水河县| 永顺县| 赤壁市| 南岸区| 西城区| 鹿泉市| 天祝| 托克逊县| 亚东县| 福泉市| 文山县| 南川市| 绵阳市| 正阳县| 扬州市| 高清| 米易县| 潍坊市| 扶余县| 柏乡县| 东安县| 西藏| 类乌齐县| 衡阳市| 两当县| 蓬莱市| 藁城市|