简体   繁体   中英

How to find and backup your local GIT repository to be able to restore it later?

Where is my local GIT repository and can I back it up and restore it if need be to the same computer or another computer later?

Update:
Sorry, to be more clear, my Mac popped up a message that says, "You haven't backed up in 12 days" and I thought, "the only thing that has changed on my computer since then is the code in my project. I wonder if I can backup my local git repository to a USB drive and if anything happens I can restore it later if I need to, to another computer. Also, I haven't committed all of my changes."

Git's "repository" is stored in the hidden .git folder in your project. You can back it up, restore it, copy it, etc.

To backup all of your files and the repository backup the parent folder of the .git directory.

/myProject
  /.git
  /myproject.txt

Backing up /myProject will backup the repository and all of your files, committed changes and uncommitted changes.

Your local git repository is a great thing to backup because it's a full git repository. You can use it always to restore your git respository, for other people, too!

Just copy the .git -directory to another place. But be aware: it could be big!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM