git的一些基本命令总结
生活随笔
收集整理的這篇文章主要介紹了
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"
慢慢熟練,不斷完善中~~~~~~~加油!!!!
總結(jié)
以上是生活随笔為你收集整理的git的一些基本命令总结的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 计算机网络怎么运行内存,运行内存,教您如
- 下一篇: 盛邦安全网站监控预警平台化繁为简 ——网