git 基礎命令

2021-10-25 09:03:06 字數 909 閱讀 7289

windows版本:

git-2.29.1-64-bit.exe 2.29.1

git init 初始化**倉庫

git status 查詢倉庫索引狀態

git add 《檔名/目錄》 新增檔案到倉庫

git config --global user.email 「[email protected]」 配置全域性的提交者郵箱

git config --global user.name 「your name」 配置全域性的提交者名字

git commit -m 「add component to project " --author=」 your name < [email protected]>" 提交暫存內容(不帶檔名的提交)

git commit somefile 提交修改後的檔案(原先已經add/commit過)

export git_edit=vim 設定提交時編輯變更資訊的編輯器

git log 檢視提交記錄

git show 《提交碼》 檢視某次提交詳細的變更資訊

git show-branch --more=n 檢視簡潔的單行提交資訊

git diff 《提交碼》 《提交碼》 檢視兩個提交之間的差異

git rm 《檔名》 刪除檔案 (需要進一步git commit)

git rm -r 《資料夾》 刪除資料夾(需要進一步git commit)

git mv git clone 建立版本庫的符本

git config –l 列出配置

git config –unset 移除設定

git reset ––hard 將版本庫和工作目錄改變為已知狀態

git checkout head – 《檔案》 恢復檔案的舊版本

git checkout head – 《資料夾》恢復檔案的舊版本

GIT 基礎 基礎命令

環境 centos7 yum install git這裡裡有個隱藏的資料夾 git 為git倉庫的配置資料夾,不可隨意修改 cd www git git init ls a git這裡和我們平時使用的git客戶端中設定使用者名稱和郵箱一樣的作用 git config global user.name...

Git 基礎命令

一 建立 git init 初始化乙個git倉庫 git add 把檔案新增到倉庫 git commit 把檔案提交到倉庫 二 顯示 git status 檢視倉庫當前的狀態 git log 檢視提交日誌 git reflog 檢視每次命令的記錄 三 管理 git reset hard head 把...

Git基礎命令

git現在廣泛應用在開發 管理中,想當年svn也是幹過這事,當然現在也還有人用,畢竟還是有情懷的嘛。對於測試,現在用git的還少,相對於檔案管理,svn還是會方便很多。當然,用習慣了git也方便,但是我第一次開始用吧,覺得特麻煩,把基礎命令總結下,免得幾日不用忘記。1.建立專案 不管是gitlab ...