Chinaunix首页 | 论坛 | 博客
  • 博客访问: 170814
  • 博文数量: 33
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 501
  • 用 户 组: 普通用户
  • 注册时间: 2013-03-26 11:00
文章分类

全部博文(33)

文章存档

2014年(11)

2013年(22)

我的朋友

分类: LINUX

2013-11-12 16:18:30

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

  • checkout remote branch
  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


----根据个人的使用,从内部知识库整理来的,如果有版权问题,请告知。
阅读(1264) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~