Repository Server
mkdir /home/src/repo
cd /home/src/repo
git init --bare
(当代码提交后,可以在refs/heads下看到各分支)
Local Host1
mkdir ~/src/proj
cd ~/src/proj
git init
git remote add origin username@server1:/home/src/repo
tar xvf source.tar.gz
find . -type d -empty -exec touch {}/.gitignore \; #将空目录也添加到版本库
git add --force .
git commit . -m "initial commit"
git push origin master
Local Host2
mkdir ~/src/mycode
cd !$
git clone user@server1:/home/src/repo
vi source.c
git commit source.c -m "modify something"
git push
git checkout -b newbranch origin/newbranch
-
add new branch to remote repo
git branch newbranch #add a new branch
git checkout newbranch #turn to the new branch
git push -u origin newbranch #commit the new branch
-
delete branch on remote repo
git push origin --delete branchname
----根据个人的使用,从内部知识库整理来的,如果有版权问题,请告知。
阅读(1308) | 评论(0) | 转发(0) |