问题
Is there an equivalent to "svnrdump dump --incremental" in GIT?
I am trying to incrementally backup several svn and git repos from a remote server to a local server but it seems that there is no direct way to "dump" a remote GIT repo.
Basically I perform either "git fetch --all" with already existing or "git clone --mirror" for all new repos followed by "git bundle create --all".
Is there any other/better solution than that?
回答1:
Once a full bundle is created, you can create new incremental bundles.
I have mentioned in this answer a script to make incremental bundles (except once a wekk a full bundle) for all my repos.
echo "Create INCREMENTAL backup for '${name}' (previous was ${_dd}-${_dt}[${s}]" >> "${logf}"
echo "${nowd} Create INCREMENTAL backup for '${name}' (previous was ${_dd}-${_dt}[${s}]" >> "${logfb}"
git -C "${path}" bundle create "${bkp}/${name}-${nowd}-${describe}-incr.bundle" --since=${nbd}.days.ago --all
status=$?
The OP confirms in the comment:
I ended up doing a "
git bundle create
" after "git fetch --all
" and/or "git clone --mirror
"
回答2:
This question is hilarious. Git (merely by virtue of being a DVCS) is by nature always an "incremental backup". One might say it is always "dumped". If a remote is set (i.e., you've cloned the remote repository), git fetch
/ git pull
will bring it up to date.
If what you need is the repository to be packaged as a single file, I would recommend you take a look at a program called tar
. If you're sure you want a full mirror (tracking the same remotes), to dump a git repo to a single file: tar c .git > /path/to/my-repo-tarball.tar
.
来源:https://stackoverflow.com/questions/24286552/git-equivalent-to-svnrdump-dump-incremental