git 基本命令

2021-10-23 11:35:30 字數 1135 閱讀 5968

git

1. 設定登入名和密碼

git config --global user.name [name]

git config --global user.email [email]

2. 設定gitte倉庫的公鑰
//1.生成乙個公鑰

ssh-keygen -t rsa -c [email]

//2.檢視公鑰

cat ~

/.ssh/id_rsa.pub

使用這個

ssh git@github

.com

使用這個

ssh -t git@gitee

.com

//5.從建立的賬號貼上到這裡就可以了

3. 從本地上傳到gitte倉庫
//1.先在遠端建立乙個倉庫,然後轉殖到本地

git clone [url]

//2.新增到本地分支

git add .

//3.提交到本地倉庫

git commit -m

//4.提交到遠端倉庫

git push

4. 分支命令
// 列出所有本地分支

git branch

// 列出所有遠端分支

git branch -r

// 新建乙個分支,但依然停留在當前分支

git branch [branch-name]

// 新建乙個分支,並切換到該分支

git checkout -b [branch]

// 合併指定分支到當前分支

git merge [branch]

// 刪除分支

git branch -d [branch-name]

// 刪除遠端分支

git push origin --delete [branch-name]$ git branch -dr [remote/branch]

5. 其他命令
//初始化git

git init

//檢視指定檔案狀態

git status [filename]

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 建...