---
layout: default
menu_item: api
title: Refspec
description: Version 0.26.1
menu_item: api
return_to:
"API Documentation Index": /api/
sections:
"parse": "#parse"
"#direction": "#direction"
"#dst": "#dst"
"#dstMatches": "#dstMatches"
"#force": "#force"
"#src": "#src"
"#srcMatches": "#srcMatches"
"#string": "#string"
---
## Refspec.parse AsyncExperimental
```js
Refspec.parse(input, is_fetch).then(function(refspec) {
// Use refspec
});
```
| Parameters | Type | |
| --- | --- | --- |
| input | String | the refspec string |
| is_fetch | Number | is this a refspec for a fetch |
| Returns | |
| --- | --- |
| [Refspec](/api/refspec/) | hold the refspec handle |
## Refspec#direction SyncExperimental
```js
var result = refspec.direction();
```
| Returns | |
| --- | --- |
| Number | GIT_DIRECTION_FETCH or GIT_DIRECTION_PUSH |
## Refspec#dst SyncExperimental
```js
var string = refspec.dst();
```
| Returns | |
| --- | --- |
| String | the refspec's destination specifier |
## Refspec#dstMatches SyncExperimental
```js
var result = refspec.dstMatches(refname);
```
| Parameters | Type |
| --- | --- | --- |
| refname | String | the name of the reference to check |
| Returns | |
| --- | --- |
| Number | 1 if the refspec matches, 0 otherwise |
## Refspec#force SyncExperimental
```js
var result = refspec.force();
```
| Returns | |
| --- | --- |
| Number | 1 if force update has been set, 0 otherwise |
## Refspec#src SyncExperimental
```js
var string = refspec.src();
```
| Returns | |
| --- | --- |
| String | the refspec's source specifier |
## Refspec#srcMatches SyncExperimental
```js
var result = refspec.srcMatches(refname);
```
| Parameters | Type |
| --- | --- | --- |
| refname | String | the name of the reference to check |
| Returns | |
| --- | --- |
| Number | 1 if the refspec matches, 0 otherwise |
## Refspec#string SyncExperimental
```js
var string = refspec.string();
```
| Returns | |
| --- | --- |
| String | |