Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
20 lines (19 loc) · 805 Bytes

File metadata and controls

20 lines (19 loc) · 805 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var nodegit = require('../'),
path = require('path');
// This example opens a certain file, `README.md`, at a particular commit,
// and prints the first 10 lines as well as some metadata.
var _entry;
nodegit.Repository.open(path.resolve(__dirname, '../.git')).then(function(repo) {
return repo.getCommit('59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5');
}).then(function(commit) {
return commit.getEntry('README.md');
}).then(function(entry) {
_entry = entry;
return _entry.getBlob();
}).then(function(blob) {
console.log(_entry.filename(), _entry.sha(), blob.rawsize() + 'b');
console.log('========================================================\n\n');
var firstTenLines = blob.toString().split('\n').slice(0, 10).join('\n');
console.log(firstTenLines);
console.log('...');
}).done();
Morty Proxy This is a proxified and sanitized view of the page, visit original site.