git git命令 常用

2021-10-10 02:00:45 字數 1455 閱讀 9242

git config --global user.name "runoob"

git config --global user.email [email protected]

2、檢視配置資訊

git config --list 

git config user.name // 檢視特定資訊

3、檢視自帶的版本

git --version
4、初始化

git init
5、檢視倉庫當前的狀態,顯示有變更的檔案

git status

git status -s // 獲得簡短的輸出結果

6、比較檔案的不同,即暫存區和工作區的差異

git diff

git diff head // 檢視已快取的與未快取的所有改動

git diff --stat // 顯示摘要而非整個 diff

7、回退版本

git reset [--soft | --mixed | --hard] [head]
8、刪除命令

git rm aa.txt // 從暫存區和工作區中刪除檔案

git rm --cached aa.txt // 從暫存區中移除檔案

9、檢視提交記錄

git log
10、移動或重新命名

git mv [file] [newfile]

git mv -f [file] [newfile] //檔名已存在,強制重新命名

11、分支

git branch (branchname) // 建立分支

git checkout (branchname) // 切換分支

git merge // 合併分支

git branch // 檢視分支

12、倉庫

git remote -v // 檢視當前倉庫位址

git remote set-url origin 倉庫位址 // 設定倉庫位址

git remote rm name // 刪除遠端倉庫

git remote rename old_name new_name // 修改倉庫名

操作命令 git git常用操作命令

1 只刪遠端倉庫檔案,但不刪本地檔案 把 iml加到 gitignore 裡面忽略掉 2.git rm r cached iml r 是遞迴的意思 當最後面是資料夾的時候有用 3.git add a 4.git commit m ignore xml 5.git push 2 檢視所有版本提交記錄,...

GIT GIT 常用命令

切換分支 git checkout name 撤銷修改 git checkout file 刪除檔案 git rm file 檢視狀態 git status 新增記錄 git add file 或 git add 新增描述 git commit m miao shu nei rong 同步資料 gi...

GIT git常用命令

這裡我只寫幾個我經常用到的命令,用到的命令會持續更新。首先使用者配置,git提交時會引用這兩條資訊,用來說明是誰提交了 git config global user.name your name git config global user.email your email 初始化倉庫,相當於將乙個...