git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Git rescue mission

From
Bill Lear <rael@zopyra.com>
Date
Feb 8, 2007, 00:18 UTC
Message-ID
<17866.27739.701406.722074@lisa.zopyra.com>

A perfect example of the sort of trouble I'm having with git just happened again.

I have a public bare repo on my machine that I have cloned to make a private repo. I just want to sync my branches on my public and private repos. I do not want to merge across branches, I just want to "sync".

So, here's what I did.
In my private repo:
%  cat .git/remotes/origin
URL: /repos/git/project
Pull: refs/heads/master:refs/heads/origin
Pull: refs/heads/topic:refs/heads/topic
And this is the sequence of unfortunate events:
Starting on topic branch:

% git commit -a -m "Fix spacing rules" % git checkout master % git pull [Won't pull non-fast-forward on my topic, so I try to get that synced.] % git checkout topic % git push [ok, fine, seems good.] [Now, instead of remembering to move back to master, I do this:] % git pull Trying really trivial in-index merge... fatal: Merge requires file-level merging Nope. [AAAAGH!] Merging HEAD with 37e229835103a11365b1e081f9b9987a88437e62 Merging: e298e7f Skip rails in user nets 37e2298 Typofixen. [NO NO NO! This is not what I want!] found 1 common ancestor(s): a2ba736 Try #2: Fixed (mostly harmless) bugs in handling of time variable. Auto-merging src/ast/tstD.cc Auto-merging src/meth/XMLImporter.cc Auto-merging src/meth/XMLImporter.hh Auto-merging src/meth/tstXMLI.cc merge: warning: conflicts during merge CONFLICT (content): Merge conflict in src/meth/tstXMLF.cc Auto-merging src/nat/MacroFanLoader.cc Auto-merging src/nat/VPE.cc Auto-merging src/nat/PnDef.cc Auto-merging src/nat/VLExporter.hh Auto-merging src/nat/tstMod.cc Automatic merge failed; fix conflicts and then commit the result.

Ok, now I'm hosed. Putting aside WHY git would do this to me (yes, I know the answer is that I asked for it), on my topic branch I now have tons of files listed when I do git status. git diff shows tons of stuff I don't want in my branch.

So, I edit the file and "fix" the merge conflict, then realize that this is probably not what I want to do at all.

So, 1) how do I get back to the status quo ante? I have about 30 files listed as "Updated but not checked in", then this:

# Changed but not updated: # (use git-update-index to mark for commit) # # unmerged: src/methodic/tstXMLI.cc # modified: src/methodic/tstXMLI.cc

which I don't want, as I just want them to go away...
2) Why does git pull do the right thing when on master, but seemingly
changes behavior when on topic?  I mean, the origin file seems to say
update topic from topic.  It says nothing about updating topic from
master, which is what seems to have happened.  When on master I get my
desired "sync" behavior, but when on topic, it merges cross-branch...
Bill
Next: Johannes Schindelin
Message 1 of 51 in “Git rescue mission”
  1. Bill LearFeb 8, 2007
  2. Johannes SchindelinFeb 8, 2007
  3. Bill LearFeb 8, 2007
  4. Johannes SchindelinFeb 8, 2007
  5. Bill LearFeb 8, 2007
  6. Junio C HamanoFeb 8, 2007
  7. Alexander LitvinovFeb 8, 2007
  8. Junio C HamanoFeb 9, 2007
  9. Alexander LitvinovFeb 9, 2007
  10. Bill LearFeb 8, 2007
  11. Jakub NarebskiFeb 8, 2007
  12. Jeff KingFeb 8, 2007
  13. Bill LearFeb 8, 2007
  14. Linus TorvaldsFeb 8, 2007
  15. Kalle PokkiFeb 8, 2007
  16. Linus TorvaldsFeb 8, 2007
  17. Kalle PokkiFeb 8, 2007
  18. Shawn O. PearceFeb 8, 2007
  19. Theodore TsoFeb 9, 2007
  20. Shawn O. PearceFeb 9, 2007
  21. Jakub NarebskiFeb 9, 2007
  22. Theodore Ts'oFeb 10, 2007
  23. Print a sane error message if an alias expands to an invalid git commandTheodore Ts'o, Feb 10, 2007
  24. Allow aliases to expand to shell commandsTheodore Ts'o, Feb 10, 2007
  25. Linus TorvaldsFeb 10, 2007
  26. Theodore TsoFeb 10, 2007
  27. Johannes SchindelinFeb 10, 2007
  28. Theodore TsoFeb 11, 2007
  29. Johannes SchindelinFeb 11, 2007
  30. Theodore TsoFeb 11, 2007
  31. Johannes SchindelinFeb 11, 2007
  32. Junio C HamanoFeb 11, 2007
  33. Johannes SchindelinFeb 11, 2007
  34. Theodore TsoFeb 12, 2007
  35. Shawn O. PearceFeb 12, 2007
  36. Junio C HamanoFeb 10, 2007
  37. Kalle PokkiFeb 9, 2007
  38. Bill LearFeb 8, 2007
  39. Linus TorvaldsFeb 8, 2007
  40. Bill LearFeb 8, 2007
  41. Bill LearFeb 8, 2007
  42. Shawn O. PearceFeb 8, 2007
  43. Bill LearFeb 8, 2007
  44. Shawn O. PearceFeb 8, 2007
  45. Jakub NarebskiFeb 9, 2007
  46. Linus TorvaldsFeb 9, 2007
  47. Michael S. TsirkinFeb 9, 2007
  48. Jakub NarebskiFeb 8, 2007
  49. Linus TorvaldsFeb 8, 2007
  50. Junio C HamanoFeb 9, 2007
  51. Jakub NarebskiFeb 8, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.