GIT equivalent to “svnrdump dump --incremental”

核能气质少年 提交于 2019-12-08 07:39:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!