AntCDL Waters
AntCDL Waters

Reputation: 29

How to do a deep check of local repository status?

Is there a way to do a detailed, deep comparison of your local GIT repo vs the remote repo?

By this I mean a full comparison of file names, dates and contents, not just a comparison that relies on the GIT history information.

This may sound like a strange request, but after having just spent hours wrestling with GIT I would like extra confirmation that my local repo is really in the state it is telling me.

Upvotes: 2

Views: 2567

Answers (3)

marbu
marbu

Reputation: 2021

Well, the hash of the last commit is based on all the information you mentioned. So all you need is to do git fetch and then check the hash of the last commit. If you would like to be extra sure, you can run git fsck to make sure the repo is in a consistent state (git fsck will basically check all the checksums so if anything was changed by some insidious error, this will catch it).

Upvotes: 3

CodeWizard
CodeWizard

Reputation: 142114

This may sound like a strange request, but after having just spent hours wrestling with GIT I would like extra confirmation that my local repo is really in the state it is telling me.

You dont need to verify it.

Using the fetch command you r local repository will be up to date with the remote repository.
Simply run this command:

# update the local repo with all the changes from the remote repo
# including tags, branches and remove deleted branches as well
git fetch --all --prune

git fetch

Fetch branches and/or tags (collectively, "refs") from one or more other repositories, along with the objects necessary to complete their histories.

Remote-tracking branches are updated .

--all

Fetch all remotes.

-p / --prune

After fetching, remove any remote-tracking references that no longer exist on the remote.

Tags are not subject to pruning if they are fetched only because of the default tag auto-following or due to a --tags option.

However, if tags are fetched due to an explicit refspec (either on the command line or in the remote configuration, for example if the remote was cloned with the --mirror option), then they are also subject to pruning.

Upvotes: 0

Mykola Gurov
Mykola Gurov

Reputation: 8695

For starters you may safely assume that two git commits having a same SHA1 are the same and focus on your working directories.

Is the same commit checked out?

Anything shown in git status?

Potentially ignored via .gitignore?

Are there any line ending conversions (mac,linux v win)?

Upvotes: 2

Related Questions