国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

GIT在Linux上的安裝和使用簡介

2019-11-15 01:42:05
字體:
來源:轉載
供稿:網友
GIT在linux上的安裝和使用簡介
GIT在Linux上的安裝和使用簡介解壓后切換到其目錄$ tar xvfj git-1.7.6.tar.bz2$ cd git-1.7.6 使用默認配置進行安裝,如果想修改配置,可以使用 ./configure --help 來獲取幫助 $ ./configure$ make$ make install 2、初始化配置GIT默認安裝在 /usr/local/bin ,安裝之后可以驗證一下是否安裝好 $ whereis gitgit: /usr/local/bin/git$ git  --versiongit version 1.7.6$ git  --help 首先需要指定用戶名和電子郵件地址 $ git config  --global user.name “GIT Admin”$ git config  --global user.emal obugs.net@Gmail.com 再驗證一下配置信息  www.2cto.com  $ git config  --listuser.name=GIT Adminuser.email=obugs.net@gmail.comcore.repositoryformatversion=0core.filemode=truecore.bare=falsecore.logallrefupdates=true 其實這些配置是存放在個人主目錄下的 .gitconfig 文件中的 $ cat ~/.gitconfig[user]name = GIT Adminemail = obugs.net@gmail.com 3、建立工程本地存儲的任何一個目錄都可以建立GIT工程,如果已有工程位于 /home/obugs/PRojects/orangebugs 目錄,就可以把這目錄定義為GIT工程$ cd /home/obugs/projects/orangebugs$ git initInitialized empty Git repository in /home/obugs/projects/orangebugs/.git/ 這樣就建立了一個名為 .git 的文件夾,這就是GIT用來存儲信息和跟蹤改動的文件夾。  www.2cto.com  $ ls -altr .gittotal 40drwxrwxr-x 4 git git 4096 Aug 13 22:39 refsdrwxrwxr-x 4 git git 4096 Aug 13 22:39 objectsdrwxrwxr-x 2 git git 4096 Aug 13 22:39 infodrwxrwxr-x 2 git git 4096 Aug 13 22:39 hooks-rw-rw-r -- 1 git git 23 Aug 13 22:39 HEAD-rw-rw-r -- 1 git git 73 Aug 13 22:39 description-rw-rw-r -- 1 git git 92 Aug 13 22:39 configdrwxrwxr-x 2 git git 4096 Aug 13 22:39 branchesdrwxrwxr-x 36 git git 4096 Aug 13 22:39 ..drwxrwxr-x 7 git git 4096 Aug 13 22:39 . 4、向工程添加和提交文件這些動作和CVS、SVN等操作類似 $ git add *.java *.c$ git commit -m ‘Initial upload of the project’create mode 100755 Orangebugs.javacreate mode 100755 pwm/ui/DataManager.javacreate mode 100755 pwm/ui/PassWordFrame.javacreate mode 100755 pwm/tools/StrongEncryption.javacreate mode 100755 pwm/tools/PasswordStrength.java.. 注意如果之前沒有使用 git config 指定用戶名和電子郵件地址,這里會報錯$ git commit -m ‘Initial upload of the project' *** Please tell me who you are.  www.2cto.com  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: empty ident not allowed 5、更改文件和提交改動編輯文件、添加或者刪除了一些字段$ vi Orangebugs.java 查看和GIT倉庫中的文件相比有了那些改動 $ git diffdiff  --git a/Orangebugs.java b/Orangebugs.javaindex 6166ed1..fd82d32 100644— a/Orangebugs.java+++ b/Orangebugs.java@@ -2,7 +2,7 @@- public counter=10+ public counter=55 如果要提交,需要先確保將文件添加到了臨時區域(staging area)然后才能提交,提交時會自動打開系統的默認編輯器,用戶添加一些注釋后保存并退出編輯器的時候,這些注釋就同時提交到倉庫中去了  www.2cto.com  $ git add Orangebugs.java$ git commit[master 80f10a9] Added password strength meter functionality1 files changed, 56 insertions(+), 7 deletions(-)或者,簡單一點的方法是使用 git commit -a 把上面兩個命令合二為一。6、查看狀態和查看注釋如果本地的文件和遠端GIT倉庫上的文件相比沒有任何改動,則 $ git status# On branch masternothing to commit (working directory clean) 如果本地做了改動但是沒有提交,則 $ git status# On branch master# Changes not staged for commit:# (use “git add …” to update what will be committed)# (use “git checkout — …” to discard changes in working directory)## modified: Orangebugs.java#no changes added to commit (use "git add" and/or "git commit -a") 另外,可以用下面的命令查看文件歷史和以往的注釋 $ git log Orangebugs.javacommit c919ced7f42f4bc06d563c1a1eaa107f2b2420d5Author: GIT Admin  www.2cto.com  Date: Sat Aug 13 22:54:57 2011 -0700 Added password strength meter functionality commit c141b7bdbff429de35e36bafb2e43edc655e9957Author: GIT AdminDate: Sat Aug 13 20:08:02 2011 -0700 Initial upload of the project

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 扶余县| 岳池县| 唐河县| 阳山县| 琼结县| 新巴尔虎右旗| 永年县| 横峰县| 上虞市| 上栗县| 平安县| 九寨沟县| 赤城县| 宁波市| 玉树县| 申扎县| 彭泽县| 开平市| 东乡县| 正宁县| 寻甸| 耒阳市| 疏附县| 昂仁县| 循化| 祁连县| 康马县| 林州市| 新干县| 通河县| 牙克石市| 蓝山县| 龙泉市| 珲春市| 蒲城县| 盖州市| 武义县| 富阳市| 昭苏县| 社旗县| 黄骅市|