1

In our company (A windows domain network), our developers use GIT as their Version Control software.

The main repository (if you can call it that) is backed up daily (fetch + clone - from the backup server)

I want to keep my user's GIT local folders (before they commit) backed up daily.

I was thinking I can get the last changes from the last fetch/commit and only save/backup the files that have changed.

Is it possible? How can I do it for the entire org? (I want an automated script that will be launched daily)

I want to avoid a situation, where a developer worked several days (can't commit work) - and loose his work due to disaster.

  • Can I track changed files? (date stamps maybe?)
Saariko
  • 1,703
  • 4
  • 26
  • 46

1 Answers1

1

You cannot fetch/clone untracked data from an upstream repo (see "Pushing untracked content with git")
That means you cannot initiate that backup process centrally.

You could distribute a script to the users which would rsync or scp their repos to a shared central path.
The other solution would be to use git archive or git bundle, but the user would add to stash his/her work in progress (which could include untracked files, but the restore would be able to distinguish between staged and untracked changes on git stash pop).

I want to avoid a situation, where a developer worked several days (can't commit work)

If you want to fetch/clone the user repo, then they must commit regularly.
Don't forget this isn't SVN: a developer can creates his/her own dev branch and commit in it even if the code doesn't compile/don't pass the test. In that aspect, dev is a private branch, used only to record daily progress by the developer.
Only public branches (the ones he/she wants to push) should contain only "clean" commits.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250