New to git here...
I want to commit my personal file share to a git repo (text, docs, images etc).
As I make modifications to various 开发者_JAVA技巧files over time, telling git about them along the way, how do go about things so I can:
- Get out of the business of traditional fulls/incrementals.
- Be able to do a point-in-time file or full clone restore.
Basically, I want something granular, such that, if I make an edit to a file 5 times on a particular day. I will have 5 versions of that file that I can refer back to- forever. Or even just derive the a full copy of everything the way it looked on that particular day.
I am currently using rsync for remote incremental syncs (no file versioning).
To initialize the process, you can simply:
git init .
git add -A
git commit -m "initiali state of my documents"
in the directory where all your documents are.
Then use one of Chris Jhonsen's suggestions to commit on each saves.
Once you want to save your all history and export it elsewhere, use git bundle
.
(and copy only one file around, anywhere you want)
As for extracting from that big bundle the exact state of a repo at a certain date, you would use the Specifying Revisions section of git rev-parse
A ref followed by the suffix
@
with a date specification enclosed in a brace pair
(e.g.{yesterday}
,{1 month 2 weeks 3 days 1 hour 1 second ago}
or{1979-02-26 18:30:00}
) to specify the value of the ref at a prior point in time.
This suffix may only be used immediately following a ref name and the ref must have an existing log ($GIT_DIR/logs/<ref>
).
Note that this looks up the state of your local ref at a given time; e.g., what was in your local master branch last week.
If you want to look at commits made during certain times, see--since
and--until
.
So to answer your question in full would take a tutorial. In summary though, git should make a decent solution for this.
You'll want to set up a git server somewhere and create a repository there and create a local clone of it. Then you can add all your files and push them to the server.
One nice things is you can do local commits without worrying about the server and then later, when it's time to backup, you do a push.
If I was going to do this, I would be worried about disk usage, but the git repository I use has a ton of history, so maybe I'm overly concerned about that for your usage.
精彩评论