2020-04-07 23:13:24 +02:00
|
|
|
# Version Control
|
|
|
|
|
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
Version control software allows you to track the changes you make to your code, as well as being
|
|
|
|
|
able to easily backtrack these changes, share your development efforts and more. Even if you are not
|
|
|
|
|
contributing to Evennia itself, and only wish to develop your own MU* using Evennia, having a
|
|
|
|
|
version control system in place is a good idea (and standard coding practice). For an introduction
|
|
|
|
|
to the concept, start with the Wikipedia article
|
2021-06-23 20:05:25 +12:00
|
|
|
[here](https://en.wikipedia.org/wiki/Version_control). Evennia uses the version control system
|
2020-06-16 16:53:35 +02:00
|
|
|
[Git](https://git-scm.com/) and this is what will be covered henceforth. Note that this page also
|
|
|
|
|
deals with commands for Linux operating systems, and the steps below may vary for other systems,
|
|
|
|
|
however where possible links will be provided for alternative instructions.
|
|
|
|
|
|
|
|
|
|
For more help on using Git, please refer to the [Official GitHub
|
|
|
|
|
documentation](https://help.github.com/articles/set-up-git#platform-all).
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
## Setting up Git
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
If you have gotten Evennia installed, you will have Git already and can skip to **Step 2** below.
|
|
|
|
|
Otherwise you will need to install Git on your platform. You can find expanded instructions for
|
2021-06-23 20:05:25 +12:00
|
|
|
installation [here](https://git-scm.com/book/en/Getting-Started-Installing-Git).
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
### Step 1: Install Git
|
|
|
|
|
|
|
|
|
|
- **Fedora Linux**
|
|
|
|
|
|
|
|
|
|
yum install git-core
|
|
|
|
|
|
|
|
|
|
- **Debian Linux** _(Ubuntu, Linux Mint, etc.)_
|
|
|
|
|
|
|
|
|
|
apt-get install git
|
|
|
|
|
|
2021-06-23 20:05:25 +12:00
|
|
|
- **Windows**: It is recommended to use [Git for Windows](https://gitforwindows.org/).
|
2020-06-16 16:53:35 +02:00
|
|
|
- **Mac**: Mac platforms offer two methods for installation, one via MacPorts, which you can find
|
2021-06-23 20:05:25 +12:00
|
|
|
out about [here](https://git-scm.com/book/en/Getting-Started-Installing-Git#Installing-on-Mac), or
|
2020-06-16 16:53:35 +02:00
|
|
|
you can use the [Git OSX Installer](https://sourceforge.net/projects/git-osx-installer/).
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
### Step 2: Define user/e-mail Settings for Git
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
To avoid a common issue later, you will need to set a couple of settings; first you will need to
|
|
|
|
|
tell Git your username, followed by your e-mail address, so that when you commit code later you will
|
|
|
|
|
be properly credited.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
> Note that your commit information will be visible to everyone if you ever contribute to Evennia or
|
|
|
|
|
use an online service like github to host your code. So if you are not comfortable with using your
|
|
|
|
|
real, full name online, put a nickname here.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
1. Set the default name for git to use when you commit:
|
|
|
|
|
|
|
|
|
|
git config --global user.name "Your Name Here"
|
|
|
|
|
|
|
|
|
|
2. Set the default email for git to use when you commit:
|
|
|
|
|
|
|
|
|
|
git config --global user.email "your_email@example.com"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Putting your game folder under version control
|
|
|
|
|
|
|
|
|
|
> Note: The game folder's version control is completely separate from Evennia's repository.
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
After you have set up your game you will have created a new folder to host your particular game
|
|
|
|
|
(let's call this folder `mygame` for now).
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
This folder is *not* under version control at this point.
|
|
|
|
|
|
|
|
|
|
git init mygame
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
Your mygame folder is now ready for version control! Now add all the content and make a first
|
|
|
|
|
commit:
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
cd mygame
|
|
|
|
|
git add *
|
|
|
|
|
git commit -m "Initial commit"
|
|
|
|
|
|
|
|
|
|
Read on for help on what these commands do.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Tracking files
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
When working on your code or fix bugs in your local branches you may end up creating new files. If
|
|
|
|
|
you do you must tell Git to track them by using the add command:
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git add <filename>
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
You can check the current status of version control with `git status`. This will show if you have
|
|
|
|
|
any modified, added or otherwise changed files. Some files, like database files, logs and temporary
|
|
|
|
|
PID files are usually *not* tracked in version control. These should either not show up or have a
|
|
|
|
|
question mark in front of them.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
### Controlling tracking
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
You will notice that some files are not covered by your git version control, notably your settings
|
|
|
|
|
file (`mygame/server/conf/settings.py`) and your sqlite3 database file `mygame/server/evennia.db3`.
|
|
|
|
|
This is controlled by the hidden file `mygame/.gitignore`. Evennia creates this file as part of the
|
|
|
|
|
creation of your game directory. Everything matched in this file will be ignored by GIT. If you want
|
|
|
|
|
to, for example, include your settings file for collaborators to access, remove that entry in
|
|
|
|
|
`.gitignore`.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
> Note: You should *never* put your sqlite3 database file into git by removing its entry in
|
|
|
|
|
`.gitignore`. GIT is for backing up your code, not your database. That way lies madness and a good
|
|
|
|
|
chance you'll confuse yourself so that after a few commits and reverts don't know what is in your
|
|
|
|
|
database or not. If you want to backup your database, do so by simply copying the file on your hard
|
|
|
|
|
drive to a backup-name.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
### Committing your Code
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
> Committing means storing the current snapshot of your code within git. This creates a "save point"
|
|
|
|
|
or "history" of your development process. You can later jump back and forth in your history, for
|
|
|
|
|
example to figure out just when a bug was introduced or see what results the code used to produce
|
|
|
|
|
compared to now.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
It's usually a good idea to commit your changes often. Committing is fast and local only - you will
|
|
|
|
|
never commit anything online at this point. To commit your changes, use
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git commit --all
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
This will save all changes you made since last commit. The command will open a text editor where you
|
|
|
|
|
can add a message detailing the changes you've made. Make it brief but informative. You can see the
|
|
|
|
|
history of commits with `git log`. If you don't want to use the editor you can set the message
|
|
|
|
|
directly by using the `-m` flag:
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git commit --all -m "This fixes a bug in the combat code."
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Changing your mind
|
|
|
|
|
|
|
|
|
|
If you have non-committed changes that you realize you want to throw away, you can do the following:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git checkout <file to revert>
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
This will revert the file to the state it was in at your last `commit`, throwing away the changes
|
|
|
|
|
you did to it since. It's a good way to make wild experiments without having to remember just what
|
|
|
|
|
you changed. If you do ` git checkout .` you will throw away _all_ changes since the last commit.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
### Pushing your code online
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
So far your code is only located on your private machine. A good idea is to back it up online. The
|
|
|
|
|
easiest way to do this is to push it to your own remote repository on GitHub.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
1. Make sure you have your game directory setup under git version control as described above. Make
|
|
|
|
|
sure to commit any changes.
|
|
|
|
|
2. Create a new, empty repository on Github. Github explains how
|
|
|
|
|
[here](https://help.github.com/articles/create-a-repo/) (do *not* "Initialize the repository with a
|
|
|
|
|
README" or else you'll create unrelated histories).
|
|
|
|
|
3. From your local game dir, do `git remote add origin <github URL>` where `<github URL>` is the URL
|
|
|
|
|
to your online repo. This tells your game dir that it should be pushing to the remote online dir.
|
2020-04-07 23:13:24 +02:00
|
|
|
4. `git remote -v` to verify the online dir.
|
|
|
|
|
5. `git push origin master` now pushes your game dir online so you can see it on github.com.
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
You can commit your work locally (`git commit --all -m "Make a change that ..."`) as many times as
|
|
|
|
|
you want. When you want to push those changes to your online repo, you do `git push`. You can also
|
|
|
|
|
`git clone <url_to_online_repo>` from your online repo to somewhere else (like your production
|
|
|
|
|
server) and henceforth do `git pull` to update that to the latest thing you pushed.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
Note that GitHub's repos are, by default publicly visible by all. Creating a publicly visible online
|
|
|
|
|
clone might not be what you want for all parts of your development process - you may prefer a more
|
|
|
|
|
private venue when sharing your revolutionary work with your team. If that's the case you can change
|
|
|
|
|
your repository to "Private" in the github settings. Then your code will only be visible to those
|
|
|
|
|
you specifically grant access.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## Forking Evennia
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
This helps you set up an online *fork* of Evennia so you can easily commit fixes and help with
|
|
|
|
|
upstream development.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
### Step 1: Fork the evennia/master repository
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
> Before proceeding with the following step, make sure you have registered and created an account on
|
|
|
|
|
[GitHub.com](https://github.com/). This is necessary in order to create a fork of Evennia's master
|
|
|
|
|
repository, and to push your commits to your fork either for yourself or for contributing to
|
|
|
|
|
Evennia.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
A _fork_ is a clone of the master repository that you can make your own commits and changes to. At
|
|
|
|
|
the top of [this page](https://github.com/evennia/evennia), click the "Fork" button, as it appears
|
|
|
|
|
below. 
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
### Step 2: Clone your fork
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
The fork only exists online as of yet. In a terminal, change your directory to the folder you wish
|
|
|
|
|
to develop in. From this directory run the following command:
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git clone https://github.com/yourusername/evennia.git
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
This will download your fork to your computer. It creates a new folder `evennia/` at your current
|
|
|
|
|
location.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
### Step 3: Configure remotes
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
A _remote_ is a repository stored on another computer, in this case on GitHub's server. When a
|
|
|
|
|
repository is cloned, it has a default remote called `origin`. This points to your fork on GitHub,
|
|
|
|
|
not the original repository it was forked from. To easily keep track of the original repository
|
|
|
|
|
(that is, Evennia's official repository), you need to add another remote. The standard name for this
|
|
|
|
|
remote is "upstream".
|
2020-04-07 23:13:24 +02:00
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
Below we change the active directory to the newly cloned "evennia" directory and then assign the
|
|
|
|
|
original Evennia repository to a remote called "upstream":
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
cd evennia
|
|
|
|
|
git remote add upstream https://github.com/evennia/evennia.git
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
If you also want to access Evennia's `develop` branch (the bleeding edge development branch) do the
|
|
|
|
|
following:
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git fetch upstream develop
|
|
|
|
|
git checkout develop
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
You should now have the upstream branch available locally. You can use this instead of `master`
|
|
|
|
|
below if you are contributing new features rather than bug fixes.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## Working with your fork
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
> A _branch_ is a separate instance of your code. Changes you do to code in a branch does not affect
|
|
|
|
|
that in other branches (so if you for example add/commit a file to one branch and then switches to
|
|
|
|
|
another branch, that file will be gone until you switch back to the first branch again). One can
|
|
|
|
|
switch between branches at will and create as many branches as one needs for a given project. The
|
|
|
|
|
content of branches can also be merged together or deleted without affecting other branches. This is
|
|
|
|
|
not only a common way to organize development but also to test features without messing with
|
|
|
|
|
existing code.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
The default _branch_ of git is called the "master" branch. As a rule of thumb, you should *never*
|
|
|
|
|
make modifications directly to your local copy of the master branch. Rather keep the master clean
|
|
|
|
|
and only update it by pulling our latest changes to it. Any work you do should instead happen in a
|
|
|
|
|
local, other branches.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
### Making a work branch
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git checkout -b myfixes
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
This command will checkout and automatically create the new branch `myfixes` on your machine. If you
|
|
|
|
|
stared out in the master branch, *myfixes* will be a perfect copy of the master branch. You can see
|
|
|
|
|
which branch you are on with `git branch` and change between different branches with `git checkout
|
|
|
|
|
<branchname>`.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
Branches are fast and cheap to create and manage. It is common practice to create a new branch for
|
|
|
|
|
every bug you want to work on or feature you want to create, then create a *pull request* for that
|
|
|
|
|
branch to be merged upstream (see below). Not only will this organize your work, it will also make
|
|
|
|
|
sure that *your* master branch version of Evennia is always exactly in sync with the upstream
|
|
|
|
|
version's master branch.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
### Updating with upstream changes
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
When Evennia's official repository updates, first make sure to commit all your changes to your
|
|
|
|
|
branch and then checkout the "clean" master branch:
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git commit --all
|
|
|
|
|
git checkout master
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Pull the latest changes from upstream:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git pull upstream master
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
This should sync your local master branch with upstream Evennia's master branch. Now we go back to
|
|
|
|
|
our own work-branch (let's say it's still called "myfixes") and _merge_ the updated master into our
|
|
|
|
|
branch.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git checkout myfixes
|
|
|
|
|
git merge master
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
If everything went well, your `myfixes` branch will now have the latest version of Evennia merged
|
|
|
|
|
with whatever changes you have done. Use `git log` to see what has changed. You may need to restart
|
|
|
|
|
the server or run `manage.py migrate` if the database schema changed (this will be seen in the
|
2021-06-23 20:05:25 +12:00
|
|
|
commit log and on the mailing list). See the [Git manuals](https://git-scm.com/documentation) for
|
2020-06-16 16:53:35 +02:00
|
|
|
learning more about useful day-to-day commands, and special situations such as dealing with merge
|
|
|
|
|
collisions.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
## Sharing your Code Publicly
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
Up to this point your `myfixes` branch only exists on your local computer. No one else can see it.
|
|
|
|
|
If you want a copy of this branch to also appear in your online fork on GitHub, make sure to have
|
|
|
|
|
checked out your "myfixes" branch and then run the following:
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git push -u origin myfixes
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
This will create a new _remote branch_ named "myfixes" in your online repository (which is refered
|
|
|
|
|
to as "origin" by default); the `-u` flag makes sure to set this to the default push location.
|
|
|
|
|
Henceforth you can just use `git push` from your myfixes branch to push your changes online. This is
|
|
|
|
|
a great way to keep your source backed-up and accessible. Remember though that by default your
|
|
|
|
|
repository will be public so everyone will be able to browse and download your code (same way as you
|
|
|
|
|
can with Evennia itself). If you want secrecy you can change your repository to "Private" in the
|
|
|
|
|
Github settings. Note though that if you do, you might have trouble contributing to Evennia (since
|
|
|
|
|
we can't see the code you want to share).
|
2020-04-07 23:13:24 +02:00
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
*Note: If you hadn't setup a public key on GitHub or aren't asked for a username/password, you might
|
|
|
|
|
get an error `403: Forbidden Access` at this stage. In that case, some users have reported that the
|
|
|
|
|
workaround is to create a file `.netrc` under your home directory and add your credentials there:*
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
machine github.com
|
|
|
|
|
login <my_github_username>
|
|
|
|
|
password <my_github_password>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Committing fixes to Evennia
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
_Contributing_ can mean both bug-fixes or adding new features to Evennia. Please note that if your
|
|
|
|
|
change is not already listed and accepted in the [Issue
|
|
|
|
|
Tracker](https://github.com/evennia/evennia/issues), it is recommended that you first hit the
|
|
|
|
|
developer mailing list or IRC chat to see beforehand if your feature is deemed suitable to include
|
|
|
|
|
as a core feature in the engine. When it comes to bug-fixes, other developers may also have good
|
|
|
|
|
input on how to go about resolving the issue.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
2021-10-21 21:04:14 +02:00
|
|
|
To contribute you need to have [forked Evennia](./Version-Control.md#forking-evennia) first. As described
|
2020-06-16 16:53:35 +02:00
|
|
|
above you should do your modification in a separate local branch (not in the master branch). This
|
|
|
|
|
branch is what you then present to us (as a *Pull request*, PR, see below). We can then merge your
|
|
|
|
|
change into the upstream master and you then do `git pull` to update master usual. Now that the
|
|
|
|
|
master is updated with your fixes, you can safely delete your local work branch. Below we describe
|
|
|
|
|
this work flow.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
First update the Evennia master branch to the latest Evennia version:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git checkout master
|
|
|
|
|
git pull upstream master
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Next, create a new branch to hold your contribution. Let's call it the "fixing_strange_bug" branch:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git checkout -b fixing_strange_bug
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
It is wise to make separate branches for every fix or series of fixes you want to contribute. You
|
|
|
|
|
are now in your new `fixing_strange_bug` branch. You can list all branches with `git branch` and
|
|
|
|
|
jump between branches with `git checkout <branchname>`. Code and test things in here, committing as
|
|
|
|
|
you go:
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git commit --all -m "Fix strange bug in look command. Resolves #123."
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
You can make multiple commits if you want, depending on your work flow and progress. Make sure to
|
|
|
|
|
always make clear and descriptive commit messages so it's easy to see what you intended. To refer
|
|
|
|
|
to, say, issue number 123, write `#123`, it will turn to a link on GitHub. If you include the text
|
|
|
|
|
"Resolves #123", that issue will be auto-closed on GitHub if your commit gets merged into main
|
|
|
|
|
Evennia.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
>If you refer to in-game commands that start with `@`(such as `@examine`), please put them in
|
|
|
|
|
backticks \`, for example \`@examine\`. The reason for this is that GitHub uses `@username` to refer
|
|
|
|
|
to GitHub users, so if you forget the ticks, any user happening to be named `examine` will get a
|
|
|
|
|
notification ....
|
2020-04-07 23:13:24 +02:00
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
If you implement multiple separate features/bug-fixes, split them into different branches if they
|
|
|
|
|
are very different and should be handled as separate PRs. You can do any number of commits to your
|
|
|
|
|
branch as you work. Once you are at a stage where you want to show the world what you did you might
|
|
|
|
|
want to consider making it clean for merging into Evennia's master branch by using [git
|
|
|
|
|
rebase](https://www.git-scm.com/book/en/v2/Git-Branching-Rebasing) (this is not always necessary,
|
|
|
|
|
and if it sounds too hard, say so and we'll handle it on our end).
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
Once you are ready, push your work to your online Evennia fork on github, in a new remote branch:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git push -u origin fixing_strange_bug
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
The `-u` flag is only needed the first time - this tells GIT to create a remote branch. If you
|
|
|
|
|
already created the remote branch earlier, just stand in your `fixing_strange_bug` branch and do
|
|
|
|
|
`git push`.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
Now you should tell the Evennia developers that they should consider merging your brilliant changes
|
|
|
|
|
into Evennia proper. [Create a pull request](https://github.com/evennia/evennia/pulls) and follow
|
|
|
|
|
the instructions. Make sure to specifically select your `fixing_strange_bug` branch to be the source
|
|
|
|
|
of the merge. Evennia developers will then be able to examine your request and merge it if it's
|
|
|
|
|
deemed suitable.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
Once your changes have been merged into Evennia your local `fixing_strange_bug` can be deleted
|
|
|
|
|
(since your changes are now available in the "clean" Evennia repository). Do
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
git branch -D fixing_strange_bug
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
to delete your work branch. Update your master branch (`checkout master` and then `git pull`) and
|
|
|
|
|
you should get your fix back, now as a part of official Evennia!
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## GIT tips and tricks
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
Some of the GIT commands can feel a little long and clunky if you need to do them often. Luckily you
|
|
|
|
|
can create aliases for those. Here are some useful commands to run:
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
# git st
|
|
|
|
|
# - view brief status info
|
|
|
|
|
git config --global alias.st 'status -s'
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
Above, you only need to ever enter the `git config ...` command once - you have then added the new
|
|
|
|
|
alias. Afterwards, just do `git st` to get status info. All the examples below follow the same
|
|
|
|
|
template.
|
2020-04-07 23:13:24 +02:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
# git cl
|
|
|
|
|
# - clone a repository
|
|
|
|
|
git config --global alias.cl clone
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
# git cma "commit message"
|
|
|
|
|
# - commit all changes without opening editor for message
|
|
|
|
|
git config --global alias.cma 'commit -a -m'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
# git ca
|
|
|
|
|
# - amend text to your latest commit message
|
|
|
|
|
git config --global alias.ca 'commit --amend'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
# git fl
|
|
|
|
|
# - file log; shows diffs of files in latest commits
|
|
|
|
|
git config --global alias.fl 'log -u'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
# git co [branchname]
|
|
|
|
|
# - checkout
|
|
|
|
|
git config --global alias.co checkout
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
# git br <branchname>
|
|
|
|
|
# - create branch
|
|
|
|
|
git config --global alias.br branch
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
# git ls
|
|
|
|
|
# - view log tree
|
2020-06-16 16:53:35 +02:00
|
|
|
git config --global alias.ls 'log --pretty=format:"%C(green)%h\ %C(yellow)[%ad]%Cred%d\
|
|
|
|
|
%Creset%s%Cblue\ [%cn]" --decorate --date=relative --graph'
|
2020-04-07 23:13:24 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
# git diff
|
|
|
|
|
# - show current uncommitted changes
|
|
|
|
|
git config --global alias.diff 'diff --word-diff'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
# git grep <query>
|
|
|
|
|
# - search (grep) codebase for a search criterion
|
|
|
|
|
git config --global alias.grep 'grep -Ii'
|
|
|
|
|
```
|
|
|
|
|
|
2020-06-16 16:53:35 +02:00
|
|
|
To get a further feel for GIT there is also [a good YouTube talk about
|
|
|
|
|
it](https://www.youtube.com/watch?v=1ffBJ4sVUb4#t=1m58s) - it's a bit long but it will help you
|
|
|
|
|
understand the underlying ideas behind GIT
|
2021-06-23 20:05:25 +12:00
|
|
|
(which in turn makes it a lot more intuitive to use).
|