For starters, I have looked into both How to backup a local Git repository? && Fully backup a git repo? but my issue lies with backing up things that I have not yet committed to the local repo.
Specifically, I use carbonite (a backup cloud service) and anytime a file in my selected directories changes, it is backed up to the cloud service. This is handy for me with subversion, because if something was to happen that corrupted my local computer, I have all of my saved code backed up.
Now that I have switched to using Git and all of my files change every time I switch branches, Carbonite recognizes it as one directory, and changes all of the backup files every time I switch.
My solution to the carbonite issue is to not backup the Git repo, but if my machine fails, then I lose my uncommitted code. Anyone have an idea on what I should do here to backup my uncommitted code?
What happens to my Uncommitted changes? “Uncommited” or even “staged” changes will be lost when you run the “reset” command! If you want to keep those you can use the “stash” command before running the reset, and after doing the “pull”, you can “apply” or “pop” the stashed changes on top of your changes.
Using the git checkout Command The git checkout -b <BranchName> command will create a new branch and switch to it. Moreover, this command will leave the current branch as it is and bring all uncommitted changes to the new branch.
git stash: a Clipboard for Your Changes You shouldn't just commit them, of course, because it's unfinished work. Your working copy is now clean: all uncommitted local changes have been saved on this kind of "clipboard" that Git's Stash represents.
Not sure would this help your case but created a tool to backup uncommitted files to a directory.
Also, can be used with a schedule task service.
Git-Uncommited-Files-Backup-Tool-Windows
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