gitgitbox

How do you backup a Git repository?


I have studied posts on StackOverflow about pushing and pulling, but here is a "greenhorn" question as a failover in case I make a mistake (which of course for me is impossible..).

The question is, if I copy the repo folder locally, and then remove both the .gitignore file and the .git folder from the copy, have I removed git's awareness of that copy folder entirely?

I am hoping the answer is yes, and again, this is just a measure until I'm totally secure between pushes and pulls from multiple branches


Solution

  • The answer is yes, this would not be treated as a git repository if the .git directory is not present. Although, there is a nice stash command inside git itself that would take you local changes and store them within itself, so that you can come back to them later.