Skip to content

Commit

Permalink
Merge pull request #237 from dxw/fix/would-clobber-existing-tag-on-fetch
Browse files Browse the repository at this point in the history
Run 'git fetch' with '--force' if no revision given
  • Loading branch information
snim2 authored Mar 25, 2024
2 parents 657c9a8 + b1a4613 commit bf78cd5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.4.1] - 2024-03-11

### Changed
- Fixed 'would clobber existing tag' error when running 'git fetch'

## [2.4.0] - 2024-01-29

### Changed
Expand Down
4 changes: 2 additions & 2 deletions src/Git/Git.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function is_repo()

public function checkout($revision)
{
list($output, $return) = $this->run_command(['git', 'fetch', '-a', '&&', 'git', 'checkout', $revision]);
list($output, $return) = $this->run_command(['git', 'fetch', '-a', '--force', '&&', 'git', 'checkout', $revision]);

return $this->check_git_return('Checkout failed', $return, $output);
}
Expand Down Expand Up @@ -213,7 +213,7 @@ public function remote_revision_commit($revision)

public function fetch()
{
list($output, $return) = $this->run_command(['git', 'fetch', '-a']);
list($output, $return) = $this->run_command(['git', 'fetch', '-a', '--force']);

return $this->check_git_return('Checkout failed', $return, $output);
}
Expand Down

0 comments on commit bf78cd5

Please sign in to comment.