or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

command.mdconfiguration.mddatabase.mddiff.mdexceptions.mdindex-staging.mdindex.mdobjects.mdreferences.mdremote.mdrepository.md

remote.mddocs/

0

# Remote Operations

1

2

Remote repository interaction including fetch, push, pull operations with comprehensive progress reporting and authentication support.

3

4

## Capabilities

5

6

### Remote Management

7

8

```python { .api }

9

class Remote:

10

def __init__(self, repo: "Repo", name: str):

11

"""Initialize remote."""

12

13

def fetch(self, refspec: str = None, progress: "RemoteProgress" = None, **kwargs) -> list["FetchInfo"]:

14

"""Fetch from remote."""

15

16

def push(self, refspec: str = None, progress: "RemoteProgress" = None, **kwargs) -> list["PushInfo"]:

17

"""Push to remote."""

18

19

def pull(self, refspec: str = None, progress: "RemoteProgress" = None, **kwargs) -> list["FetchInfo"]:

20

"""Pull from remote."""

21

22

@property

23

def name(self) -> str:

24

"""Remote name."""

25

26

@property

27

def url(self) -> str:

28

"""Remote URL."""

29

30

class RemoteProgress:

31

def update(self, op_code: int, cur_count: Union[str, float], max_count: Union[str, float] = None, message: str = "") -> None:

32

"""Update progress."""

33

34

class FetchInfo:

35

@property

36

def ref(self) -> "Reference":

37

"""Updated reference."""

38

39

@property

40

def flags(self) -> int:

41

"""Fetch flags."""

42

43

class PushInfo:

44

@property

45

def flags(self) -> int:

46

"""Push flags."""

47

48

@property

49

def local_ref(self) -> "Reference":

50

"""Local reference."""

51

52

@property

53

def remote_ref(self) -> "RemoteReference":

54

"""Remote reference."""

55

```

56

57

## Usage Examples

58

59

```python

60

from git import Repo, RemoteProgress

61

62

class MyProgress(RemoteProgress):

63

def update(self, op_code, cur_count, max_count=None, message=''):

64

print(f'Progress: {cur_count}/{max_count} - {message}')

65

66

repo = Repo('/path/to/repo')

67

68

# Work with remotes

69

origin = repo.remotes.origin

70

71

# Fetch with progress

72

fetch_info = origin.fetch(progress=MyProgress())

73

74

# Push changes

75

push_info = origin.push()

76

77

# Add new remote

78

new_remote = repo.create_remote('upstream', 'https://github.com/user/repo.git')

79

```