@@ -1355,25 +1355,47 @@ int error = git_remote_list(&remotes, repo);
1355
1355
<h3 id =" remotes_load " >Loading</h3 >
1356
1356
1357
1357
``` c
1358
+ git_remote *remote = NULL ;
1359
+ int error = git_remote_load(&remote, repo, " origin" );
1358
1360
```
1359
1361
(
1360
- [ ``] ( ) ,
1362
+ [ ` git_remote_load ` ] ( http://libgit2.github.com/libgit2/#HEAD/group/remote/git_remote_load )
1361
1363
)
1362
1364
1363
1365
<h3 id =" remotes_create " >Creating</h3 >
1364
1366
1367
+ Both of these methods save the remote configuration to disk before returning.
1368
+
1365
1369
``` c
1370
+ /* Creates an empty remote */
1371
+ git_remote *newremote = NULL ;
1372
+ int error = git_remote_create(&newremote, repo, " upstream" ,
1373
+ " https://github.com/libgit2/libgit2" );
1374
+
1375
+ /* Pre-populates a new remote with a fetchspec */
1376
+ git_remote *newremote2 = NULL ;
1377
+ error = git_remote_create(&newremote2, repo, " upstream2" ,
1378
+ " https://github.com/libgit2/libgit2" , /* URL */
1379
+ " +refs/heads/*:refs/custom/namespace/*" ); /* fetchspec */
1366
1380
```
1367
1381
(
1368
- [ ``] ( ) ,
1382
+ [ ` git_remote_create ` ] ( http://libgit2.github.com/libgit2/#HEAD/group/remote/git_remote_create ) ,
1383
+ [ ` git_remote_create_with_fetchspec ` ] ( http://libgit2.github.com/libgit2/#HEAD/group/remote/git_remote_create_with_fetchspec )
1369
1384
)
1370
1385
1371
1386
<h3 id =" remotes_in_memory " >Creating (in-memory)</h3 >
1372
1387
1388
+ This method creates a remote that cannot be saved.
1389
+ This is useful for one-time fetches.
1390
+
1373
1391
``` c
1392
+ git_remote *remote;
1393
+ int error = git_remote_create_inmemory(&remote, repo,)
1394
+ " +refs/heads/*:refs/custom/namespace/*" , /* fetchspec */
1395
+ " https://github.com/libgit2/libgit2" ); /* URL */
1374
1396
```
1375
1397
(
1376
- [ ``] ( ) ,
1398
+ [ ` git_remote_create_inmemory ` ] ( http://libgit2.github.com/libgit2/#HEAD/group/remote/git_remote_create_inmemory )
1377
1399
)
1378
1400
1379
1401
<h3 id =" remotes_rename " >Renaming</h3 >
0 commit comments