git初始化
git config --global user.name "填寫自己的用戶名" # 配置個(gè)人用戶名
git config --global user.email 填寫自己的郵箱號(hào) #電子郵件地址
git config --list #查看配置信息
ssh-keygen -t rsa -C [郵箱] #生成ssh秘鑰
cat /Users/apple/.ssh/id_rsa.pub #獲取ssh秘鑰
git托管項(xiàng)目
git init #初始化git倉庫
git add . #管理文件
git commit -m '備注' # 提交版本
git push origin master #push至origin主機(jī)中的master分支
git push #上傳至上次上傳倉庫
git remote add [shortname] [url] #新增遠(yuǎn)程倉庫
git remote -v #查看遠(yuǎn)程倉庫
git remote rm [name] # 刪除遠(yuǎn)程倉庫
git clone [url]#下載項(xiàng)目
git config --global credential.helper store#保存用戶名和密碼不用再輸入
分支
git branch #查看分支
git branch -a #查看全部分支
git branch [branchname] #創(chuàng)建分支
git checkout [branchname] #切換分支
git branch -d [branchname] #刪除本地分支
git push [remotename] --delete [branchname] #刪除遠(yuǎn)程分支
git checkout -b branchName commitId #根據(jù)指定版本號(hào)創(chuàng)建分支
git fetch #是將遠(yuǎn)程主機(jī)的最新內(nèi)容拉到本地,用戶在檢查了以后決定是否合并到工作本機(jī)分支中。
git pull #則是將遠(yuǎn)程主機(jī)的最新內(nèi)容拉下來后直接合并,即:git pull = git fetch + git merge,這樣可能會(huì)產(chǎn)生沖突,需要手動(dòng)解決。
git merge [branchname] #合并分支
生成ssh秘鑰
ssh-keygen -t rsa -C "your_email@example.com"
cd ~/.ssh
cat id_rsa.pub
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。