Updated Using Git with Mapbase (markdown)

Blixibon 2020-12-09 23:08:43 -06:00
parent 0a24d95513
commit 6a0d31497f

@ -1,13 +1,52 @@
Mapbase was specifically designed to be merged into forks of Source 2013 by using Git. This lets you merge Mapbase into an existing mod or update an existing mod already running on Mapbase quickly and easily.
Mapbase's code was specifically designed to be merged into forks of Source 2013 by using Git. This lets you merge Mapbase into an existing mod or update an existing mod already running on Mapbase quickly and easily.
## What is Git?
# Setting up Git
**Git** is a "version control" system which keeps track of files (usually code) and changes to those files. It can even merge files with different changes together.
[*This tutorial was originally written by Xenthio.*](https://github.com/Xenthio/hs-game/blob/master/test.md) *(todo: Clarify stuff, explain how to fix an incompatible repo, etc.)*
Setups of Git usually involve two different repositories: A "local" repository (the one on your computer) and a "remote" repository (the one on a server or website). GitHub is used as a website to store and handle remote repositories.
Download Git:
- **Windows** - Download and install [Git for Windows](https://git-scm.com/downloads).
- **Mac** - type ```git``` in terminal, if git isn't installed already, it will prompt you to install it. Git can also be installed with [Homebrew](https://brew.sh).
- **Linux** - If it isn't installed already, install Git using your distro's [Package Manager](https://www.debian.org/doc/manuals/aptitude/pr01s02.en.html).
## How can I use Git to implement or update Mapbase?
It may be beneficial to use a GUI for Git as well, like [TortoiseGit](https://tortoisegit.org) or [Sourcetree](https://www.sourcetreeapp.com), but this tutorial will use command line instructions.
You need to pull from the Mapbase remote.
## Forking the Mapbase repository
(TODO: Git Bash commands, maybe Sourcetree/TortoiseGit instructions)
The Mapbase repository on GitHub can be forked by clicking [here](https://github.com/mapbase-source/source-sdk-2013/fork).
Once you've set up a repo on GitHub, open up the terminal or command prompt of your choice. Type `cd` followed by the directory of your choice. (EXAMPLE: ```cd "E:\My Mapbase Fork"```)
Type ```git clone <REPO-LINK>```
###### This clones the repo to your computer. (EXAMPLE: ```git clone https://github.com/xenthio/source-sdk-2013```)
A new folder will be created using the name of the repository (normally `source-sdk-2013`) in the directory you navigated to with `cd`. It will contain a local copy of the repository on GitHub.
## Committing and Pushing Changes
Whenever you make a change, you should commit and push (upload) the change to the GitHub repo.
Do this by navigating to your repo's directory in the command line and typing:
```git add path/to/file.txt```
###### Adds the file to the commit, do ```git add .``` to add all changed files.
```git commit -m "Change Message"```
###### Commits the files, the message can be anything, e.g "Cleaned up code" or "Squashed some bugs", makes it easy to tell which commit changed what.
```git push```
###### Upload all commits you just made to the repo.
## Merging Mapbase updates
When ever a Mapbase update is released, you can merge the changes into your repo. Make sure you've pushed all local commits before doing this.
Head over to the terminal, navigate to your repo's directory and type:
```git fetch upstream```
###### Gets all commits from the Mapbase master branch into a temporary branch.
```git checkout master```
###### Goes back to the normal master branch of your repo.
```git merge upstream/master```
###### Merges the master branch with the Mapbase master branch.