Probably a simple question but when you are using git locally on your computer do you lose branches and commits when the computer is turned off?
No. When a repo is initialized with git, all local changes and branches are saved in the git working directory. This is somewhat same as saving a file in your computer. Hence, local changes will not but losed.
A commit is just a snapshot of the contents of the repository. When you give commit, git computes a hash value over the contents of the repository and saves the state of the repository. Here is a good reference on recording changes to git repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With