Reputation: 25380
I'll preface this by saying I'm relatively new to git, and I'm leaning on the Eclipse git GUI probably more than I should. Anyway, here's what happened:
git pull
this morning, while checked out on my branch, and the changes to master were brought into my workspace.So now the non-working versions of certain files are in my workspace, even though I branched before those changes were checked in. This is a bit of a surprise.
Could someone help me understand why git is importing these changes while I'm branched, and how to control this behavior? At the least, I'd like to revert the files that don't compile to earlier versions, and prevent git from merging additional changes from master into my branch until I'm ready to merge back into master. Ideally, I'd like to bring in some of the changes made by the other developer, because some files in the project are very difficult to merge.
Here is the git config for my copy of the repository. I'm on MYBRANCH:
[core]
symlinks = false
repositoryformatversion = 0
filemode = false
logallrefupdates = true
[remote "origin"]
url = ssh://[email protected]:7999/foo/bar.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "SOMEOTHERBRANCH"]
remote = origin
merge = refs/heads/master
[branch "MYBRANCH"]
remote = origin
merge = refs/heads/master
Upvotes: 0
Views: 58
Reputation: 61
Additionally to revert changes from your branch you should see the command git reset
http://git-scm.com/docs/git-reset
Upvotes: 1
Reputation: 19015
So the problem here is that MYBRANCH
is set up to track origin/master
, which means that when you do a git pull
, origin/master
will be merged into it. You can untrack it by doing git config --unset branch.MYBRANCH.merge
. Assuming there is an origin/MYBRANCH
, you can track it by doing git branch -u origin/MYBRANCH
(while on MYBRANCH). If origin/MYBRANCH
does not yet exist, you can create/track it with git push -u origin MYBRANCH
.
Upvotes: 3