On Fri, 19 Jun 2015 03:51:46 -0700 (PDT)
fs...@entornosdeformacion.com wrote:

> after a commit and push from my local branch to the remote one, I can
> see in the server (through the web page) that one of the committed
> files is broken. Differences shown in the commit are incompleted and
> the whole file is truncated. But if I look into my local file,
> everything is ok.
> 
> I tried with "git diff BRANCH origin/BRANCH" and no errors appear.
> So, how can I get the differences between the remote and the local
> file??
> 
> And more important, how can I upload my current local file and fix
> the remote one?

Before rushing to fix the sutiation I'd first verify the file is truly
broken.

The thing is, all the stuff in Git repositories is linked using the
SHA-1 hashes calculated over the contents of that stuff.  In other
words, commits link to their tree objects using the SHA-1 hash
calculated over the contents of that tree object; tree objects refer to
the blobs representing their files using, again, SHA-1 hashes
calculated over the contents of those files.  This means, if something
is *that* broken *and* Git does not notice this, it's way more likely
that the underlying filesystem (or disk drive) is hosed rather than the
file is corrupted.  A misbehaving web front-end is also more likely to
happen that the corruption of a file in the Git database.

To verify, you have several options.

The simplest is to first fetch from the remote and then see at the file.

Something like

  git fetch origin

and then

  git show origin/BRANCH:path/to/that/file

or

  git diff BRANCH origin/BRANCH path/to/that/file

If that's OK but you'd like to dig deeper, log into the server, where
the remote repository is located, `cd` to that repository's directory
and look at that file:

  git show BRANCH:path/to/that/file

If you'll notice that the file is indeed botched, return to us for
further assistance.

-- 
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/d/optout.

Reply via email to