This is a tutorial show how to version your saves using Git.
Q: Why would anyone go through this process?
A: Because if you do, you can undo an otherwise un-undoable action, such as swimming in a pit of lava and accidentally dropping your Notch armpit forged special edition diamond pickaxe and your 35 stacks of cobblestone.
- Linux
- Ubuntu/Debian
sudo aptitude install git
- Other dists
- Use the source, Luke.
- Ubuntu/Debian
- Windows
- Download msysGit
I would choose the "Full installer for official Git 1.7.4" -- or in a few years; "Full installer for official Git \d(.\d(.\d)?)?" - Install it!
- Download msysGit
- Mac
- I'd love to provide more details, but I do not have access to a Mac OS X environment.
Installers are found on the git-osx-installer download page. I wish you good luck even though I am sure it is no more confusing than the Windows installer.
- I'd love to provide more details, but I do not have access to a Mac OS X environment.
- Windows
- As described in a post on the Minecraft forum
- Open "Run" from the start menu
- Enter
%appdata%/.minecraft/saves
in the box - Press RETURN
If this does not take you to a folder looking somewhat like this, check the forum thread for further directions.
- As described in a post on the Minecraft forum
- Linux
I can't confirm this, but I suspect it might be in$HOME/.minecraft/saves
A StackExchange Gaming post confirms that the save folder is indeed located at~/.minecraft/saves
- Mac
- According to the aforementioned StackExchange Gaming post; It is located at
~/Library/Application Support/minecraft/saves/
- According to the aforementioned StackExchange Gaming post; It is located at
The worlds are all logically named after this view in minecraft:
If any of the things mentioned in this section should spawn questions in your head that you absolutely want answered, try the Git Immersion git tutorial. It will teach you git from the bottom and up.
If the Git Immersion tutorial does not answer your questions, try Google. There is an almost infinite amount of posts, discussions and manuals available to answer your questions. Some of them do it better than the others.
This chapter and the following pages of the Git Immersion tutorial concerns the points mentioned in this tutorial.
The only difference between this case and the cases mentioned in the Git Immersion tutorial is that we are mostly dealing with binary files and not text files.
-
Fire up your command-line interface.
- Windows
- Start ⇒ Programs ⇒ Git ⇒ Git Bash
- Mac
- Spotlight ⇒ Search for "Terminal" — Or something similar to this
- Linux
- Well, duh. Hints: "Terminal",
xterm
etc.
- Well, duh. Hints: "Terminal",
- Windows
-
Change the current working directory for your command-line-interface to the appropriate World[1-5] folder in the
saves
directorycd /c/Users/YOURNAME/AppData/Roaming/.minecraft/saves/World1
for World 1.
-
Initialize the git repository
git init
# Notice the dot git add . # You might add -s after, If you have set up your user.name and user.email values in your git configuration git commit -m "Initial commit"
git add .
should output nothing but a blank space.git commit [...]
should output something like this
You now have a snapshot of your selected minecraft world.
-
Run
git add . git commit -m "Before stupidly walking into lava, an event which I have not at all planned. This is just in case"
This creates a new save point for you, a savepoint that you can revert back to.
By running
git log
you should be able to see the "savepoint" or commit, as git calls it. Mine is called "Befor(e) dying".
-
Load your world
-
?????!?!?!?!
-
Run
git log
this will show you the most recent commits with the most recent commit at the top
You will need the SHA1 value that is associated with the specific commit. In this case
07c1925969e2bd30fa4e940656c7ab8573f1ddb0
. -
Run
git reset --hard y0ursha1c0mm1774gv41u3 # WARNING: This step is to my knowledge irreversible; once you back, you never go back.
this will return
HEAD is now at l0l0l0l Before stupidly walking into lava, an event which I have not at all planned. This is just in case
Awesome. Scripting the saves via a cron job (say, every 20 minutes) would also be really handy for server backups. Not sure what the equivalent of a cron job would be in Windows though.