Ginu Jacob
Ginu Jacob

Reputation: 1778

Git : Check whether a new version exist for the modified files in local repository

In the repository if let's say there is

If the apple.c and orange.c are modified in the local copy. Is there a git command to check the repo status for only these locally modified files (probably useful before checkin).

Upvotes: 1

Views: 513

Answers (3)

Ashutosh Jindal
Ashutosh Jindal

Reputation: 18869

I believe the OP is asking for a way to see if the files that have been changed locally have been updated on remote.

Here is what you can do:

Update remote repository's local cache via git fetch. Then, it should be possible to local uncommitted changes against the remote tracking branch. Try the following:

$ git fetch origin
$ git diff origin/master

Note that origin/master is one local branch, a shorthand for refs/remotes/origin/master, which is the full name of the remote-tracking branch.

Upvotes: 2

Mark Brown
Mark Brown

Reputation: 322

git diff will show all changes in current directory.

git diff <path to file> will show changes for the file supplied

Similarly you can you can use git add like above to be more selective of which files you commit.

Upvotes: 0

Roman Marusyk
Roman Marusyk

Reputation: 24579

Try to use:

git diff apple.с
git diff orange.с

See documentation

Upvotes: 1

Related Questions