Question

I'm converting the infrastructure at my workplace to use git instead of svn. The overall migration is going well, but we have a tool that I developed to do our SQL schema migrations.

In order to deal with individual schema change dependencies, the migrations script used subversion keyword replacement to put the last-changed revision number in the schema. With git, we can't use the same idea, since revision history is non-linear (and we're fully intending on utilizing the branching features).

Therefore, how do I get a topologically sorted list of commit ids out of git? Barring that, anyone have a better idea for how to handle this problem?

Was it helpful?

Solution

git rev-list old-revision..new-revision

That shows newest-first. If you want oldest-first, add --reverse

OTHER TIPS

If you want to have a way to track where a file came from in your source code repository, you may want to look into tagging your work and finding some way to mark the file with the tag it came from. Some of this depends on your actual deployment process, but my short answer would be to replace svn keywords with a tag-based mechanism. (It may have been what you should have been doing in svn all along, actually.)

I've heard "smudge filters" mentioned around here, but I haven't used them myself, so I can't speculate how they might fit in here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top