git config --global user.email "[email protected]"
git config --global user.name "Your Name"
添加一个用户账号:git:123456
将atweiquan工程的父级目录共享,比如D:\work\atweiquan,将work共享 设置该共享目录,Everyone和git,具有读取权限
在git bash中,进入到atweiquan工程根目录,运行以下命令(除了自己的):
git remote add liu file:////192.168.1.88/repos_liu/atweiquan
git remote add wang file:////192.168.1.36/workspace_server/atweiquan
git remote add chen file:////192.168.1.64/repos_chenm/atweiquan
git remote add yang file:////192.168.1.7/work/atweiquan
也可以直接编辑./atweiquan/.git/config,修改wang和url部分
[remote "wang"]
url = file:////192.168.1.36/workspace_server/atweiquan
fetch = +refs/heads/*:refs/remotes/wang/*
克隆整个项目
git clone [email protected]:atweiquan.git
查看分支
git branch
切换到develop分支
git checkout develop
查看修改状态
git status
添加文件
git add <filename>
删除文件
git rm <filename>
提交代码,进入VI,i输入注释, :wq
git commit -a
获取他人最新的develop分支代码
git pull liu develop
git pull yang develop
git pull wang develop
在develop基础上创建功能分支feature-xxx,并切换到feature-xxx
git checkout -b feature-xxx develop
开发功能分支feature-xxx时,本地可以频繁add/rm/commit
git add xxxx
git commit -a -m "代码提交信息"
开发完功能分支feature-xxx后,将feature-xxx合并到develop,删除feature-xxx
git checkout develop
git merge –-no-ff feature-xxx
git branch -d feature-xxx
获取他人最新的develop分支代码
git pull liu develop
git pull yang develop
git pull wang develop
获取他人的分支,feature-x是wang的分支,feature-y是本地分支名,可以=feature-x
git fetch wang feature-x:feature-y
比较
git diff
日志
git log
http://rogerdudler.github.com/git-guide/index.zh.html