9

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?

Community
  • 1
  • 1
Cody Brown
  • 375
  • 3
  • 17
  • Commit your code locally and all branches of code will backed up, no? Or use git itself: create a remote repo, commit your work in progress to a local branch, and push to the remote. – Matt S Jun 30 '16 at 20:31
  • Would you really lose your code if your computer failed? If you copied the whole folder off carbonite, it would still have your local changes, no? – Brian Malehorn Jun 30 '16 at 21:39
  • @BrianMalehorn this would be true only if the branches local changes were currently checked out. For example, if I switched branches, carbonite would backup the new branch in place of the old branch. So if the branch wasn't checked out, then yes I would really lose my code. – Cody Brown Jul 05 '16 at 17:48
  • It seems like this article can help: https://matthew-brett.github.io/curious-git/curious_remotes.html Basically, you can make a branch from a target branch (git checkout -b local-changes) and push this branch to a "backup" remote. After you feel that the work is done, you can commit whatever you need and then rebase "temporary" branch into the target (possibly squashing the commits). – Pavel Sapehin Oct 28 '18 at 16:02

1 Answers1

1

Not sure would this help your case but created a tool to backup uncommitted files to a directory.

enter image description here

Also, can be used with a schedule task service.

Git-Uncommited-Files-Backup-Tool-Windows

  • Based on your requirements I do get some ideas to tweak the app
Shazni Shiraz
  • 111
  • 1
  • 6
  • 1
    This isn't a relevant issue for me anymore, but seeing as nobody else has ever came to the plate on this one, and your application seems to do what I needed, I'll mark you as the correct answer! Nice job :) – Cody Brown Apr 19 '21 at 19:00