Help with starting fresh local repository and keeping remote repository

I have spent quite a bit of time getting my home directory synced with my GitHub repository and I am satisfied with what is being tracked remotely.

I would like to start fresh locally (git init), then clone/pull my remote repository to my local machine.

If I just do a git init, what damage would that do to my remote repository if any. What exactly would I be losing at the local repository that would not be gained back by clone/pull after the git init? Would you recommend that I do this to get a fresh start?

Also, would git clone be the right thing to do to bring the files back to the local machine after the git init?

Does this make sense?

What are you hoping to gain with the “fresh start”? I can’t think of any situation where that’d be beneficial, unless the git internal data got messed up so badly that it can’t recover.

Exactly none, unless you then force-push the new repository to the remote one. Init is a purely local action.

No. Clone implies init, so doing init where you want to clone to doesn’t make sense. You can either clone directly (no previous init), or if you want to do it by hand you need to do init, add the remote, fetch, and checkout (or possibly reset to) the right branch.

Thanks for your response.
I was thinking that I could get rid of a lot of nonsense history of me making minor changes and pushing them to the repository. I was thinking that it would be easier to see my changes in the future without having to wade through all the little stuff.

I am using zsh and powerlevel10 and it has a nice feature that shows me what is going on with my repositories when I enter that directory. However, when I enter my home directory, it does not show me that. I was thinking that if I clean things up, I could clone/pull and instead of having the files go into userfiles locally, I could maybe override that and force it to go the ~/. I thought that that might fix the Master not showing up on my prompt. Am I close or way off base?


You’d get all the history back from the remote repository. :wink: If you want to clean it up you’ll have to use git rebase, see:

Note the pitfalls mentioned there, but for a personal repository the most important thing might be to double check you’re not deleting anything you want to keep.

I can’t comment on that specific shell setup.

Thanks. 🙂

1 Like