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

Re: Files different for me

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 25, 2009, 17:55 UTC
Message-ID
<7vd4d62ygo.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<450196A1AAAE4B42A00A8B27A59278E709E047DE@EXCHANGE.trad.tradestation.com>
"John Dlugosz" <JDlugosz@TradeStation.com> writes:
Show 5 quoted lines
> I'm working with a group, and using git for source code.  I need to
> change a couple files temporarily and just for me.  I thought, "that's
> easy", just don't stage them when I check in changes.  But, what do I do
> when I pull changes from others?  I think it will complain that I have
> unsaved changes.  What's the best way to do this?
[jc: Overlong lines wrapped]

This typically happens when a configuration file of some sort that *must* be different in each work tree is tracked.

"git pull" and "git merge" do not care when you have local changes to paths *and* the merge does not involve them, and errors out without touching any files in your tree when the merge needs to touch them. You can safely deal with your local changes after seeing such an error. This, and because such a file tend to be modified much less often than the real contents, means that:

 (1) you do not usually have to worry about this issue, and can keep your
     small local changes you do not mind losing around, and
 (2) when you have to recover, you can easily stash your changes away,
     redo the pull and unstash them.

If you want an "I do not have to think" solution, an easiest recipe to follow would be:

    $ git stash
    $ git pull
    ... potentially resolve conflicts and make a merge commit ...
    $ git stash pop

But as described above, stash/stash pop are superfluous for most of the time.

Previous: Matthieu MoyNext: Linus Torvalds
Message 7 of 17 in “Files different for me”
  1. John DlugoszFeb 25, 2009
  2. Brian GernhardtFeb 25, 2009
  3. John DlugoszFeb 25, 2009
  4. Brian GernhardtFeb 25, 2009
  5. John DlugoszFeb 25, 2009
  6. Matthieu MoyFeb 25, 2009
  7. Junio C HamanoFeb 25, 2009
  8. Linus TorvaldsFeb 25, 2009
  9. Junio C HamanoFeb 25, 2009
  10. Linus TorvaldsFeb 25, 2009
  11. Junio C HamanoFeb 25, 2009
  12. Linus TorvaldsFeb 25, 2009
  13. Jay SoffianFeb 25, 2009
  14. John DlugoszFeb 25, 2009
  15. John DlugoszFeb 25, 2009
  16. Junio C HamanoFeb 25, 2009
  17. Feanil PatelFeb 25, 2009

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.