So there’s github, which is a pretty set of web pages, and there’s git, the underlying command line interface version control system that github is providing a limited graphical user interface for. I apparently don’t really know how to use github, but I do know how to use git.
So first off: git is an open-source, freely available version control system with a command line interface. There’s a lot of tools to make using git simpler, but I’m going to stick with the basics. git is available for all systems - you just need a command line interface to get it going. There’s a bunch of ways to do that - if you’ve got a Linux system, you just open up a command terminal; if you’re using Windows, I really recommend installing cygwin (cygwin.org) because that gives you a Linux work-alike interface. (I’m a professional Linux programmer so there may be some pro-Linux bias in this discussion; Windows people are welcome to provide better alternate solutions).
git works on three things: repositories, branches, and commits. A repository is a collection of branches consisting of serial lists of commits, where each commit is the change in the files under version control from the previous one. Your github repository is one repository, but you can have others and use push and pull to transfer commits between them.
So the first thing you want do after you get access to git on a command line interface is to clone your github repository onto the same computer that you’re running git on. Go to your github page, hit the green “clone or download” button, and then type "git clone " folllowed by the URL they give you.[1] This will download a copy of your repository to your computer.
You can change directory into your new repository, and use the git command line to manipulate the local repository. For instance (I’m looking at your repository on github now, btw), you could do “git reset --hard 47d21c” and that would reset your local repository to only include your first two commits[2]. Then you could push your local repository back up to the github repository by doing “git push --force”, which will overwrite the github repository with the branch history of your local repository.
Alternately, another thing you could and possibly should do is stop editing your mod as a stand alone project, and instead make it a branch of a fork[3] of the main C:DDA repository. The way you would do that is:
- Go to https://github.com/CleverRaven/Cataclysm-DDA
- Hit the “Fork” button and now you have your own version of C:DDA.
- Clone that to your local machine with the “Clone or Download” button.
- Go into your new C:DDA directory and run “git remote add upstream https://github.com/CleverRaven/Cataclysm-DDA”, then “git fetch upstream”, then “git checkout -b upstream-master upstream/master”. That will set your local repository to follow changes in the main C:DDA repository.
- run “git checkout -b reds-odd-adds upstream-master” to create a new branch based on the latest upstream commit.
- go back to your Reds-Odd-Additions repository at github, and copy your commits back to your local C:DDA repository. use “git add” to add changes to a commit, and “git commit” to commit your changes. Just put your stuff where it belongs under data/mods/ .
If you’re feeling really adventuresome, you can compile C:DDA on your local machine - which is easy to do under Linux and a pain under Windows (or at least, I haven’t gotten it working but haven’t tried hard).
Alternately, you can just download the latest verison for your system type and copy the executables into your local C:DDA repository, which is how I actually play C:DDA on Windows.
The reason you want to go through this hassle is that you can periodically pull in all the changes from upstream into your local repository, keeping your game up to date without requiring that you move your save files around or mess with moving your mod.
But that’s a discussion for a slightly later date.
[1] You probably want to select the “use SSH” option, which means setting up your github account to allow SSH. See https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/
[2] Your entire repository consists of 2 branches with a total of 3 commits. How much old stuff are you trying to get rid of here?
[3] A fork is just a new, private version of a project, and is often used to develop changes and then push them back to the main project.