|
||||
|
|
OOTP 17 - General Discussions Everything about the latest Out of the Park Baseball - officially licensed by MLB.com and the MLBPA. |
|
Thread Tools |
08-14-2016, 11:19 AM | #1 |
Minors (Double A)
Join Date: Mar 2016
Location: Pittsburgh, PA
Posts: 183
|
Backing Up Leagues with Git
Mentioned I used git to backup my leagues, and then it came up outside the forum about how I actually DO it, so I figured this would be useful to everyone, especially considering it will be MUCH easier to keep track of your backups, and save precious HD space.
I'm assuming using the commandline version of git here. There are several GUI based clients for all operating systems, but using them is an exercise for the reader. Everything here however will map to some option in a GUI client. * assuming your league is in a League.lg directory 1) init the repo Go into your league directory and type "git init". This will create a .git directory and let us use git to manage all the files. 2) Create your first commit SAVE YOUR GAME. Type "git add ." in the League.lg directory, and it will add in all the files to be in your first commit. You can see these files with the "git status" command. It may give you several warnings about wanting to convert CRLF characters into LF. This is normal and can be ignored. Git wants everything as standard LF on its backend[Ed. Note: Windows needs to get with the program and use LF like everyone else]. After the files are stated, you can do "git commit -m "Insert useful message here" ". Useful messages could be "Opening Day 2016", "Changed MiLB playoff formats", "Want to see if I can trade for Joey Bag O'Donuts". 3) Create your next commit So you've played a bit, and want another snapshot. You can go though the same procedure as above for your second commit. Stage the files with "git add ." and then "git commit -m "Another Message Here" ". It will only store the changes since the last commit. This means all those generated reports, generated facegen files, etc. etc. are only in once place. You've not going to have 30 copies of the same file every commit. Reverting to previous versions Ok, you went though, and now are like "something's screwy here with how I set this up, I want to go back". Well, every commit has an ID associated with it. So run "git checkout <SHA1 hash>" of the commit you want to go back to, then "git clean -f" to get rid of every file that wasn't a part of that commit—for instance, generated gamelogs, facegens, etc. Then you can go on with things from that spot, make new commits, etc. Note you can also just use the first 7 digits of the hash to refer to a given commit....well actually ANY amount of numbers as long as it's unique to the commit, but 7 is the standard for a short hash. Starting game with your last commited state You did a commit, then decided you wanted to just go back to your last backup. Exit the game, run "git clean -f" to remove all the new files that were generated, then run "git checkout ." to return your league to the state it was when you last did your commit. When you load the league again, you will be where you last did a commit. There's a lot more stuff you can do with this, these aren't 100% the commands I use, I just wanted to post a "quick" little walk-though on getting started with using git to manage your league. I HIGHLY suggest you work with this with a test league first. Also nice if you want to use your favorite scripting language to automate some of this stuff. But this should be enough to get you started and get you running. Last edited by homerj; 08-14-2016 at 11:23 AM. Reason: made commands bold, added "starting game with last commited state" |
Bookmarks |
|
|