问题描述:

You can't (without setting a .gitconfig setting) push to a repository unless it's a bare repository.

But I found that you can in fact do that, if all it's doing is a fast forward to the remote repository. Okay, makes sense.

So let's say non-bare repositories A and B are in sync and I make a change to A, add it, commit it to A, and then I git push B master

Git does this without complaint but what I end up with is the change going into B's index. Not the repository, and not the working tree.

I'm not sure I understand why it does that, but that aside for the moment, without committing, how can I pull the changes into B's working tree?

Checkout doesn't work because the change isn't in the repository yet, reset doesn't work for similar reasons. Merge, same thing.

When I say git checkout master it says M <filename> of the file with the change but it doesn't actually merge anything.

git merge says already up to date.

So I'm a little lost here...

  1. why does the push from A to B put the changes in the index, not

    the repository, and

  2. how can I pull the changes (without committing first) from B's

    index to B's working tree?

EDIT:

I'm playing some more, I made 2 new repositories to try this out and now it won't let me push because it says the other repository has that branch checked out.

But that's the same situation I have where it does let me push to the branch, it's the same master branch.

相关阅读:
Top