Git基本命令

2021-08-27 22:28:50 字數 946 閱讀 8258

cd /d  進入目錄

git init 將當前目錄初始化為git**倉庫

git status 檢視當前倉庫中狀態,有無新檔案,已經是否有檔案發生了修改

git add . 將當前倉庫中新的檔案加入追蹤(暫存)

git commit -m "***xx" 將加入暫存區的檔案提交(到本地,既當前目錄中),並用-m引數加入提交資訊

git log 檢視歷史提交的內容

git reset --hard commitid 將回到指定的commit,既刪除此次commit之後的提交和檔案修改

git reset commitid 將回到指定的commit,僅刪除此次commit之後的提交,但檔案修改保留

git remote add origin [email protected]:peacesouth/firstgitdemo.git 將遠端加入為origin倉庫

git push -u origin master 將commit之後的**push到遠端倉庫,-u是建立本地當前的倉庫和遠端的倉庫的對映

git clone [email protected]:peacesouth/firstgitdemo.git(遠端倉庫位址) gitlab2(將建立的新的倉庫位址) 使用ssh協議將遠端的倉庫拉到後面的新倉庫位址

git clone gitlab3 使用https協議

git branch dev 基於當前分支(可能是分支的分支)上建立乙個新的分支

git branch 檢視當前專案的所有分支

git checkout deve 切換到dev分支上

git commit . -m "command" 將沒track到的修改一次提交,不需要使用git add .命令也可以提交(但是新加的檔案必須還要先執行add命令)

git merge dev 假設當前所在分支是mater,此命令是將制定的分支(dev)merge到當前的分支上(master)

git 基本命令

man git man git commit man git pull man git merge git config global user.name yourname git config global user.email yourname example.com cd home git m...

Git 基本命令

git config global user.name xx git config global user.email x com 1.建立專案資料夾 mkdir myproject 2.進入專案資料夾 cd myproject 3.初始化專案 git init 4.建立 readme.md tou...

Git 基本命令

說明 以下所有操作命令 均在 git bash 下執行,即命令為linux風格 檔案 以 txt 為例 其中,建立某乙個倉庫,在某一具體路徑下 執行 git init即可 幫助命令 git help 建立 respository git init 刪除 respository rm rf git 建...