Samuel Fullman
Samuel Fullman

Reputation: 1312

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

Upvotes: 0

Views: 126

Answers (2)

Nikhil Gupta
Nikhil Gupta

Reputation: 1778

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.

Upvotes: 0

dezman
dezman

Reputation: 19358

If you make a copy of a repo folder, neither the original or the copy will be aware of each other, even while the .git and .gitignore folder / file are present.

In most cases (excluding submodules) the only knowledge a particular repo folder will have of other repos, exists as its remote, origin or otherwise.

Upvotes: 2

Related Questions