2 2git的使用方法

2021-10-06 04:35:11 字數 1125 閱讀 3805

title

date

comments

categories

br#git的常用方法

2020/2/1

true

必備技能

必備

技能

2.2

git clone [倉庫位址] 把遠端的檔案拷貝到本地.

git add [檔案1 檔案2] 把有改變的檔案(增,刪,改)加入git版本控制.

-a (包括刪除掉的檔案也會被暫存)

git push origin [branch-name] 提交到branch-name分支 -f 強制推送

git pull 拉取最新**

git branch -vv 檢視當前所屬分支

git rm --cache ***x -f 徹底的刪除,不進入**站

轉殖指定的分支 git clone -b 《指定分支名》 《遠端倉庫位址》

git 生成ssh key 命令步驟

git config --global user.name "你的使用者名稱"

git config --global user.email "你的郵箱"

cd ~/.ssh/ (沒有.ssh目錄就自己建立)

#最關鍵的一步

ssh-keygen -t rsa -c "你的公司或個人郵箱"

#連按三次回車 生成私鑰和公鑰 id_rsa和id_rsa.pub

#用記事本開啟id_rsa.pub,複製裡面的內容新增到你github或者#bitbucket ssh設定裡即可

拷貝公鑰到伺服器命令

ssh-copy-id -i id_dsa.pub [email protected]

github識別錯程式語言,可以手動在專案根目錄下新增

.gitattributes檔案寫入以下**(格式如下)

*.html linguist-language=html *.js linguist-language=html *.md linguist-language=markdown

git的使用方法

專案上傳至線上 git add git commit 備註 git push git branch 顯示所有分支 git branch newbranch 在本地建立新的分支 git checkout newbranch 切換到新的分支 git push origin newbranch 將新的分支...

Git的使用方法

2 使用git 進入cmd中切入自己需要記錄的檔案內,輸入命令 git init 執行,執行後檔案目錄中會多乙個 git 的資料夾 在目錄中建立乙個 hello.txt 檔案 如內容如下 然後在命令列中執行 git add 檔名 此時執行後沒有任何反饋的,只是將檔案存入快取中還未真正的上傳到git ...

git的使用方法

1.先把檔案新增到git git add readme.txt 2.在提交 m是提交時候寫的一句話 git commit m wrote a readme file 要隨時掌握工作區的狀態,使用git status命令 如果git status告訴你有檔案被修改過,用git diff可以檢視修改內容...