Reputation: 919
I have just read Version Control is not a BaCkUp system (pdf).
and I wonder if there is a good way to backup my code into a remote server at the end of the day (in case something happens to my laptop), with all my temporary changes that definitely shouldn't be committed.
Upvotes: 2
Views: 7793
Reputation: 405
Commit your changes. And then reverse this commit. Push them. Next day you can reverse the reverse commit again or cherry pick the first one.
Upvotes: 0
Reputation: 4319
i personally like the git archive command. it pulls out a given commit and saves it. no version control, just the files that make up said commit
example zip command:
git archive --format=zip --output /full/path/to/zipfile.zip master
example tar.gz command:
git archive --format=tar --output /full/path/to/zipfile.zip master | gzip
Upvotes: 2
Reputation: 172698
If you put the .git
subdirectory into a cloud sync service like Dropbox, you'd just have to git add --update
your uncommited changes to the index at the end of the day, and it's automatically backed up to the cloud.
(I do not recommend putting your entire working copy into Dropbox, because your editing / build process would probably cause excessive background updates during the day.)
Upvotes: 1
Reputation: 172698
I'd just git commit --all
everything with a subject of WIP
(or just supply --fixup
), and then push to the remote.
First thing the next morning git reset HEAD^
and continue where you left off.
Upvotes: 1
Reputation: 129734
You can make a temp branch, commit what's staged, add unstaged, commit. Force push that up (perhaps to a different remote). git checkoung -
.
Do that each day just before leaving work.
Upvotes: 1
Reputation: 8478
If you have a private repo on a remote server you can just commit everything, including the bad stuff, then the next day you update your repo with the good stuff, possibly resetting some of your previous day's work. This is just an idea. Or use a dev branch and only merge good commits, rebased, into master. If you have a private repo this will not be seen by anybody. Free private repos are available in many places like baregit.com or elsewhere.
Upvotes: 1