git

package
v0.0.0-...-f2e6f42 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient() (interfaces.GitOperations, error)

NewClient crea un nuevo cliente Git y detecta el entorno.

func NewClientForTest

func NewClientForTest(config *types.GitConfig, exec executor) interfaces.GitOperations

NewClientForTest crea un cliente con un ejecutor específico para pruebas.

Types

type Client

type Client struct {
	Config *types.GitConfig
	// contains filtered or unexported fields
}

Client es el cliente para interactuar con Git.

func (*Client) Add

func (c *Client) Add(files string) (string, error)

Add añade archivos al staging area. Soporta múltiples archivos separados por espacios o comas.

func (*Client) BranchList

func (c *Client) BranchList(remote bool) ([]types.BranchInfo, error)

func (*Client) Checkout

func (c *Client) Checkout(branch string, create bool) (string, error)

func (*Client) CheckoutRemote

func (c *Client) CheckoutRemote(remoteBranch string, localBranch string) (string, error)

func (*Client) Clean

func (c *Client) Clean(operation string, dryRun bool) (string, error)

func (*Client) Commit

func (c *Client) Commit(message string) (string, error)

Commit realiza un commit con el mensaje proporcionado.

func (*Client) ConflictStatus

func (c *Client) ConflictStatus() (string, error)

Métodos para acceder a la configuración

func (*Client) CreateBackup

func (c *Client) CreateBackup(name string) (string, error)

func (*Client) CreateFile

func (c *Client) CreateFile(path, content string) (string, error)

func (*Client) DetectPotentialConflicts

func (c *Client) DetectPotentialConflicts(sourceBranch string, targetBranch string) (string, error)

func (*Client) DiffFiles

func (c *Client) DiffFiles(staged bool) (string, error)

func (*Client) ForcePush

func (c *Client) ForcePush(branch string, force bool) (string, error)

func (*Client) GetChangedFiles

func (c *Client) GetChangedFiles(staged bool) (string, error)

func (*Client) GetCurrentBranch

func (c *Client) GetCurrentBranch() string

func (*Client) GetFileContent

func (c *Client) GetFileContent(filePath, ref string) (string, error)

func (*Client) GetFileSHA

func (c *Client) GetFileSHA(filePath string) (string, error)

func (*Client) GetLastCommit

func (c *Client) GetLastCommit() (string, error)

func (*Client) GetRemoteURL

func (c *Client) GetRemoteURL() string

func (*Client) GetRepoPath

func (c *Client) GetRepoPath() string

func (*Client) HasGit

func (c *Client) HasGit() bool

func (*Client) Init

func (c *Client) Init(path string, initialBranch string) (string, error)

Init inicializa un nuevo repositorio Git en la ruta especificada

func (*Client) IsGitRepo

func (c *Client) IsGitRepo() bool

func (*Client) ListFiles

func (c *Client) ListFiles(ref string) (string, error)

func (*Client) LogAnalysis

func (c *Client) LogAnalysis(limit string) (string, error)

func (*Client) Merge

func (c *Client) Merge(sourceBranch string, targetBranch string) (string, error)

func (*Client) Pull

func (c *Client) Pull(branch string) (string, error)

func (*Client) PullWithStrategy

func (c *Client) PullWithStrategy(branch string, strategy string) (string, error)

func (*Client) Push

func (c *Client) Push(branch string) (string, error)

Push realiza un push a la rama especificada.

func (*Client) PushUpstream

func (c *Client) PushUpstream(branch string) (string, error)

func (*Client) Rebase

func (c *Client) Rebase(branch string) (string, error)

func (*Client) Remote

func (c *Client) Remote(operation, name, url string) (string, error)

func (*Client) Reset

func (c *Client) Reset(mode string, target string, files []string) (string, error)

Reset realiza un reset a un commit especificado con el modo indicado (hard, soft, mixed)

func (*Client) ResolveConflicts

func (c *Client) ResolveConflicts(strategy string) (string, error)

func (*Client) ResolveFile

func (c *Client) ResolveFile(filePath string, strategy string, customContent *string) (string, error)

ResolveFile resuelve un archivo específico en conflicto

func (*Client) SafeMerge

func (c *Client) SafeMerge(source string, target string) (string, error)

func (*Client) SetWorkspace

func (c *Client) SetWorkspace(workspacePath string) (string, error)

func (*Client) ShowConflict

func (c *Client) ShowConflict(filePath string) (string, error)

ShowConflict muestra los detalles de un conflicto en un archivo específico

func (*Client) Stash

func (c *Client) Stash(operation, name string) (string, error)

func (*Client) Status

func (c *Client) Status() (string, error)

func (*Client) SyncWithRemote

func (c *Client) SyncWithRemote(remoteBranch string) (string, error)

func (*Client) Tag

func (c *Client) Tag(operation, tagName, message string) (string, error)

func (*Client) UpdateFile

func (c *Client) UpdateFile(path, content, _ string) (string, error)

func (*Client) ValidateCleanState

func (c *Client) ValidateCleanState() (bool, error)

func (*Client) ValidateRepo

func (c *Client) ValidateRepo(path string) (string, error)

type ConflictDetails

type ConflictDetails struct {
	File       string           `json:"file"`
	HasBase    bool             `json:"hasBase"`
	Markers    []ConflictMarker `json:"markers"`
	Content    string           `json:"content,omitempty"`
	Suggestion string           `json:"suggestion"`
}

type ConflictMarker

type ConflictMarker struct {
	Ours   string `json:"ours"`
	Theirs string `json:"theirs"`
	Base   string `json:"base,omitempty"`
}

Helper types para manejo de conflicts

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL