2

I work in a lot of different projects and would like to use git-tfs from several computers without an extra bare repository.

My idea is to store the git-tfs repository on a share and do all pushes into a work branch. Merge changes to the master and push to tfs.

I was hoping I could do something like this:

Clone from tfs and create a "work" branch

cd centralrepository
git tfs quick-clone --shared http://tfs.. $/tfsfolder .
git branch work

On the client side clone work branch

git clone --branch work --single-branch path/to/centralrepository

do work on client side, commit and push to central

...
git commit -m"my work"
git push

on central again, get updates from tfs, apply changes in 'work' and push back

git tfs pull
git rebase master work
git checkout master     // rebase checks out the work branch
git merge work
git tfs checkintool

now back on client, pull and continue work

git pull 
...
git push

But this does not work which is probably obvious for experienced git users

What happens is that changes are merged both in central and client causing conflicts since rebase will apply changes twice.

Is the whole idea flawed or am I just missing some step.

adrianm
  • 14,468
  • 5
  • 55
  • 102

1 Answers1

1

When thinking through the scenario a bit more I found the error.

The work branch should of course not be rebased in the central repository. work should just be merged with master and then fast forwarded.

It should look like this:

git tfs pull
git merge work
git checkout work
git merge -ff-only master
git checkout master
git tfs checkintool
adrianm
  • 14,468
  • 5
  • 55
  • 102