版本控制

版本控制是一種軟體工程技巧,藉以在開發(fā)的過程中,確保由不同人所編輯的統(tǒng)一檔案都得到更新 ,記錄代碼變更。

目前用到的最廣泛的控制器就是SVN和Git。

SVN(Subversion)是集中式管理的版本控制器,Git是分布式管理控制器,這是兩者最本質(zhì)的區(qū)別。

集中式:

分布式:

svn

集中式管理的代表,版本庫存放在中央服務器。只要中央服務器跪了,就無法正常工作了。

https://tortoisesvn.net/

git

分布式管理的代表,每個人都是一個版本庫,通常我們會也有選擇一個“中心倉庫”。彌補了集中式管理的缺陷。

https://git-scm.com/

常見托管平臺

http://code.taobao.org/

https://www.oschina.net/

Git基本使用

這里我們就根據(jù)開發(fā)需求,以操作為準去學習。

軟件安裝

add-apt-repository ppa:git-core/ppa

apt update

apt install git

注冊github并激活

https://github.com/

創(chuàng)建一個項目

命令初體驗,下載項目

git clone URL

配置用戶信息

git config --global user.name "Rock"

git config --global user.email "rockrong1204@aliyun.com"

用PyCharm打開項目并配置Git信息,Git忽略

圖形化更新代碼

圖形化提交代碼

重要概念

工作區(qū)

暫存區(qū)

本地倉庫

遠程倉庫

分支

Git指令

git init

git status

git add

git commit

git commit -m "Message"

git log

git diff

git reset

git reset --hard version_code

git rm

git rm -f FileName

git mv

git branch

git branch BranchName

git branch -d BranchName

git checkout

git checkout BranchName

git checkout -b BranchName

git checkout FileName

git merge

git tag

git tag "TAG_name"

git tag -a "TAG_name" version_code

git tag -d TAG_name

git show

git show TagName

git stash

git stash drop

git stash pop

git stash apply

git remote

git rebase

git rebase BranchName

git rebase --continue

git rebase --abort

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容