日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

git的一些基本命令总结

發(fā)布時間:2023/12/14 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 git的一些基本命令总结 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

最近剛剛開始使用Git,對于所有的一些命令以及環(huán)境都不是很熟,這里個人總結(jié)一下。

1.git的安裝和初次使用配置

? ?ubuntu安裝git下直接命令

sudo apt-get install git

? ?git一般和repo一起使用,所以需要配置repo

#you can rename the dir according to your habits mkdir [devDir] && cd [devDir]#-------------------------------------------------------- #references: https://source.android.com/source/downloading.html #install repo #you can change the dir but you must ensure the dir is included in your PATH mkdir ~/bin PATH=~/bin:$PATH#Download Repo and ensure it is executable #make sure the dir the same as before curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+x ~/bin/repo
? ?初次使用git需要配置user.name以及user.email

#First time must set user.name and user.email git config user.name "[username]" git config user.email [username@example.com]
? ?初始化repo,也就是通過ssh與相應(yīng)的git服務(wù)其建立鏈接

#initialize repo repo init -u ssh://[url].git

? ?最后一部同步代碼

#until now you can Sync codes from the git repo sync
至此相應(yīng)的開發(fā)代碼已經(jīng)同步到對應(yīng)的目錄[devDir]下。

注:以上命令中,帶有"[ ]"的都是需要根據(jù)實際情況替換的。


2.開發(fā)過程中使用git的一般流程

? ?同步代碼,前面已經(jīng)說過;

? ?創(chuàng)建分支

git branch [branch] --track origin/[branch]

? ?

? 關(guān)聯(lián)分支

git branch [branch] --set-upstream origin/[branch]


? 查看分支狀態(tài)

git branch

? 切換到[branch]分支

git checkout master

? 將修改完畢的code加入到暫存區(qū) git add .
? 查看當(dāng)前暫存區(qū)狀態(tài)

git status
? 將暫存區(qū)的修改提交到本地庫

git commit -s -m "comment"


? 上傳項目代碼到服務(wù)器git系統(tǒng)

repo upload .

慢慢熟練,不斷完善中~~~~~~~加油!!!!

總結(jié)

以上是生活随笔為你收集整理的git的一些基本命令总结的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。