2023-01-16 14:56:28 +00:00
|
|
|
---
|
|
|
|
categories:
|
|
|
|
- DevOps
|
2023-04-06 14:30:22 +01:00
|
|
|
tags: [git, procedural]
|
2023-01-16 14:56:28 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# Reset to remote version of a branch
|
|
|
|
|
2024-02-02 15:58:13 +00:00
|
|
|
The scenario: your local Git history has become corrupted in some way and you
|
|
|
|
want a clean history based on the current state of the remote. We will
|
|
|
|
demonstrate with `main`.
|
2023-01-16 14:56:28 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
git fetch origin
|
2023-03-17 11:06:12 +00:00
|
|
|
git reset --hard origin/main
|
2023-01-16 14:56:28 +00:00
|
|
|
```
|