-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c25e6f
commit 9080f65
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Replace a Git Repository with a New One | ||
|
||
Sometimes you need to reset a remote Git repository while keeping your local history intact. Here's how: | ||
|
||
**1. Add the Remote:** | ||
```bash | ||
git remote add origin <remote-url> | ||
``` | ||
|
||
Links your local repo to the remote. | ||
|
||
**2. Force Push to Overwrite Remote History:** | ||
```bash | ||
git push --force --set-upstream origin main | ||
``` | ||
|
||
Replaces the remote history with your local history. | ||
|
||
|