3

How can I bundle a git project without cloning it every time? Right now I do always commands below.

git clone --mirror http://git_project
cd git_project
git bundle create '../git_project.lock' --all
cd ..
rm git_project -Force -Recurse

I want to do this in one command, something like:

git bundle create '../git_project.lock' --all --repository http://git_project
NoobTW
  • 2,243
  • 2
  • 23
  • 39
H. Pauwelyn
  • 12,572
  • 26
  • 77
  • 129
  • No way — `git bundle` works only with local repository. Why do clone the project every time? Clone it once and update later with `git fetch/pull`. Improve by using bare repo. – phd Feb 07 '19 at 11:45
  • @phd: I'll to got these bundle files as a backup on an other machine. like on this answer: https://stackoverflow.com/questions/5578270/fully-backup-a-git-repo#answer-5578292 – H. Pauwelyn Feb 07 '19 at 12:04
  • Then run `git bundle` on that other machine. – phd Feb 07 '19 at 12:07
  • @phd: It's in the cloud... We don't have access to that machine... – H. Pauwelyn Feb 07 '19 at 12:08
  • 1
    Then local clone is your only option. But you don't need to clone every time. Clone once, preserve the clone, and then update it with `git fetch/pull`. Create backup bundles from the clone as usual. – phd Feb 07 '19 at 12:10
  • @phd: But when you don't remove your repository, `git bundle create` has no sense at all. I'll think about it what's the best thing. Thanks for the info @phd :) – H. Pauwelyn Feb 07 '19 at 12:50

0 Answers0