Terry Djony
Terry Djony

Reputation: 2015

Git repo remote change folder

I created a git repository in folder A. And then, I push it to a remote (let's say it's called D) Then, I delete folder A, and create a new folder B with very different files/folders inside it. And, I want to change the remote D so it's pointing to B.

How to do it? thanks

Upvotes: 0

Views: 708

Answers (1)

Learath2
Learath2

Reputation: 21343

  1. Initialize a new git repository in B: git init
  2. Add all files in B: git add .
  3. Commit: git commit -a -m "Initial commit"
  4. Add D as a remote git remote add origin <D>
  5. Force push to D: git push -fu origin master

This will destroy the history on D, so beware and if some one else is referring to that remote it might piss them off.

Upvotes: 1

Related Questions