【发布时间】:2012-03-03 14:49:09
【问题描述】:
- Project.git 是一个远程 git 仓库,有一个暂存分支
- 两个开发人员正在开发他们自己的 project.git 分支
- 两个开发人员都只与登台交互
两个开发者共同
# Developer 1 & developer 2 add staging as follows
$ git clone myForkOfProject.git
$ git remote add live project.git
开发人员 2 处理文档
[master] $ git branch docs
[master] $ git checkout docs
[docs] $ git add README
[docs] $ git commit -m "pushing to live's staging from local's docs works" README
[docs] $ git push live docs:staging
开发人员 1 正在修复错误,希望有选择地合并文档
开发者 1 希望看到选择性地将文档中的文件合并到他的本地 mybranch
[master] git branch mybranch
[master] git checkout mybranch
[mybranch] $ git fetch live staging
# Checks to see if anything changed
[mybranch] $ git status -s ./
[mybranch] $
# Doesn't know what to merge since diff, status shows no change
# Where as if developer1 did
[mybranch] $ git pull live staging
[mybranch] $ git status -s ./
A README
developer1 真正想要的是什么
developer1 想要做的只是将 staging 中的最后更改提取到工作目录中,而不自动添加 README。
如何拉取/获取以便git status -s ./ 只下载更改
[mybranch] git *fetch changes from staging into mybranch 's working directory*
[mybranch] git status -s ./
[?] README
# This is what developer1 wants to see
# so that he can decide to 'git add README' manually
# here are the unsuccessful attempts to do the same
# Developer2 makes a commit, and does git push live docs:staging
[mybranch] $ git fetch live staging
[mybranch] $ git pull live staging --no-commit --no-log --no-ff
我的最后一个选项是选择性地调用git rm --cached README,但我想知道我是否在git fetch、git merge 流程中遗漏了什么。
【问题讨论】: