CVCS:中央分布式控制系统,typical:SVN
DVCS:Git;
Git accounts up 74%,and svn accounts up 22%;
Difference:CVCS means 中央版本控制系统必须同时存在服务端和客户端,在业务流程过程中,服务端必须存在,所有请求必须经过服务端的处理。
DVCS:主要是将备份的代码以及记录完全独立在本地存储。本地版本控制器不需要依赖网络便可以完成此操作.
How to install Git under windows/linux/mac;
1.Windows: Download git-for-windows;
2.Linux: apt-get install / yum install …
3.Mac: brew install git;assumption that you have installed Homebrew.
1 Repo
It means that It includes all file,directory.
mkdir oop_git
cd oop_git
git init
touch test.py
git add test.py; git add .(means add all files)
git commit -m "add test.py"
git log
git reset --hard //Version Description:1.head,head^; 2. ID
2.Working Direc,Stage,Repository
Working Direc means current files in local computer.
Stage:Storage all changes tempally;
Repository: Storage for git commit ;
Create a Branch only for Personal develop.Others cant see it.
At the beginning,head -> master;
git checkout -b dev "means create a new branch called dev;
git branch "For View all branches.
After that,all changes and commits works dev-branch.
git checkout master "Switch to master
git merge dev "For merge dev
git branch -d dev "For del dev-branch
Especially: git-log-graph for View branch graphic.
git add & git commit is neccessery.
Reference: https://www.liaoxuefeng.com/wiki/896043488029600/1216289527823648
git clone [email protected]:xxx "Means take remote repo into local computer and create working Direc;
git remote add origin "origin is alias of RepoName;
When finished all Add and Commit,You can use git push origin master for sync branch record.
For update latest code(Maybe added by others);
正常的推送更改流程为:先更新本地最新代码,再先 Add 和 Commit 本地修改,然后拉取远端更改,如果此时出现了合并冲突(英文:Merge Conflict),解决合并冲突。然后,在合并冲突解决后推送更改。