0

Business Case Requirement: I would like to have a way to attach (document) the current git (build?) with a periodic datadump/snapshot process.

=================================================

Edit: Let's try to make this question clearer.

We have a routine snapshot process that captures substantial amounts of data

Our GIT repo works just fine - not problem with it and we have it in multiple locations

We have lots of updates occurring on production. Some change the production schema.

We want to include some indicator of the exact build used in production at the moment of the snapshot.

Goal: If a restore is required we can pull form the repo and the snapshot and know the two were meant for each other :)

=================================================

Snapshots are like life insurance - pray you never need it but hope to hell you have it when you do...

It would be very nice to know exactly what the status of an App was at the time of it's data snapshot.

What useful commands does git have to support an operation to document it's current position as well as the position of remote and local repositories of course.

What would be the best switches to use (and why)?

Are the specific output forms that are more useful for those situations when a restore might be required -- perhaps even ways to pre-script the process?

git status by itself doesn't seem to tell all that much although I do see the -porcelain switch and other possible goodies to investigate.

Techmag
  • 1,383
  • 13
  • 24
  • Can you tell us more about what information you want to capture. Actually, `git status` does give quite a bit of information. – Tim Biegeleisen Dec 16 '15 at 16:44
  • I want to reliable be able to get back to that moment in time when the data was snapshot in case we need to account for schema differences etc. I hate to answer "all of it" as I know that is a useless answer. This is more of a "whats on the menu" in the first place question. – Techmag Dec 16 '15 at 19:27
  • @Techmag It sounds like you want a tool called Git! Every commit in Git is an actual snapshot of your application. You can always checkout any commit whenever you want. – Joseph K. Strauss Dec 17 '15 at 02:15
  • I'm already using `git` :) I just want to use it more responsibly... – Techmag Dec 17 '15 at 15:19
  • If you're worried about losing objects in individual clones of Git repositories, you should simply back up your `.git` directories. Also, you should be able to make a shallow clone of a local repository given its path, which is a handy way of having a `.git`-only copy of the repository. – Nick McCurdy Dec 23 '15 at 08:07

1 Answers1

1

I just found this question which essentially answered what I'm trying to accomplish.

How to retrieve the hash for the current commit in Git?

Seems the magic was simple enough: git log -1

Now I just run that into a text file that gets included in the backup/snapshots and I have the precise location in GIT of where we are code-wise at the exact time the backup/snapshot was made.

git log -1 > /backup_location/gitstatus.txt

I'm sure there is far more elegant ways of accomplishing this and perhaps this can be extended to write an actual script to do a pull from the repository if required but at least I have the raw knowledge that git status just didn't seem to be telling me.

Community
  • 1
  • 1
Techmag
  • 1,383
  • 13
  • 24