I was looking for git-bundles as an option to keep my 2 repositories (being continuously worked on) in sync with each other.
Since both are two different geographical locations and setting up a VPN is also not an option I plan to use bundles..(Any other better alternative or method? )
I stumbled upon Jefromi's answer here . It explains things very well.
However if I have multiple branches being worked on and I wanted to update them all, how do I do it?
(The answer uses basis for master but uses --branches that will copy the complete history of all other branches in bundle again. I want only updated/added commits of all braches)
You can create a new backup while excluding what was in the previous backup:
git fetch ../backup.bundle
git bundle create ../newbackup.bundle ^backup/A ^backup/B A B C
Here you create an incremental backup with incremental history for branches A
and B
, plus the new branch C
.
You can see that approach detailed in "Incremental backups with git bundle, for all branches"
I prefer the simpler approach of using the date of the last backup:
cd myRepo
git bundle create mybundle-inc --since=10.days --all
It is ok to backup "a bit more": duplicate commits won't be imported twice when you will use that incremental backup.
I have made a script based on --since
: save_bundles.