First, don't panic. Nothing is lost.

It sound like the 'pull' workflow you are using, does not match the work style 
of the upstream project.

A 'pull' does two things. 

First it fetches the appropriate updates (which git version/OS are you using?) 
from the upstream and stores them in the remote refs. (that is all the objects 
are put in the object store and the remote branch pointers stored in 
/refs/remotes/<remotename>/<branchname> ). This step is just making sure you 
have a perfect copy of the upstream work.

Second it tries to merge what has been fetched with your local branch (again 
various configurations determine which remote branch merges with your local 
branch). This step is a local work flow that assumes you have been doing some 
local work that you want to merge into the upstream. Obviously, in this case, 
that isn't true.

As I understand it you simply want your local working branches to match those 
of the upstream. So you want your branch's head ref, to point at the same place 
as that you have just fetched. (which may be that the upstream did that heinous 
crime of a forced update of their published branch! leaving you here)

The basic advice here is don't pull, just fetch (it better matches your 
workflow).  

Then do a 'gitk --all' to view all the different branches and their locations, 
and then do the update you need. 

One such update is "git branch -f localbranch remote/remotebranch" 
(borrowed from 
http://stackoverflow.com/questions/4156957/merging-branches-without-checkout/4157435#4157435,
 and 
http://stackoverflow.com/questions/5147537/how-do-i-fast-forward-other-tracking-branches-in-git/5148202#5148202)

Do use the gitk (or other equivalent) visualiser to see how your branch and the 
remote branch have diverged. You won't need to download 5Gb! You should already 
have all the data you need.

Philip



----- Original Message ----- 
  From: nmac...@iburst.co.za 
  To: git-users@googlegroups.com 
  Sent: Thursday, January 02, 2014 4:42 AM
  Subject: [git-users] File in master messed up after adding someone's topic


  I just use git to keep up with bleeding edge changes to a project. Don't 
edit/commit or anything.
  Added someone's topic to get their files for review.
  Then removed the topic.
  However, one file in master was changed by adding the topic. (I didn't touch 
it.)
  Now I can no longer do a pull because it reports a merge conflict.
  I can access the latest version of that file (master version), and use copy 
and paste, but of course git then says I have edited the file and I must either 
stash or commit. 
  Stashing reverts me to the incorrect version of the file.
  What can I do? Short of starting from scratch - the repository is about 5GB - 
12 hours download.


  -- 
  You received this message because you are subscribed to the Google Groups 
"Git for human beings" group.
  To unsubscribe from this group and stop receiving emails from it, send an 
email to git-users+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to