Guy
Guy

Reputation: 13306

git - get remote file content

Is there a way in git to get the content of a specific file on the remote repo?

I would like, using gulp, to get the remote package.json version and manipulate the local package.json to match.

The goal is to prevent re-occuring git conflicts on the package.json version field.

Upvotes: 3

Views: 2071

Answers (1)

Hauleth
Hauleth

Reputation: 23566

If you have fetched data from remote (all you need is to git fetch, it will not touch your current working tree) you can then use:

git show <ref>:<path>

So in your example you can view content of the file via

git show origin/master:package.json

Upvotes: 4

Related Questions