Git For Thl Rails Apps

THL Toolbox > Developers' Zone > GIT for THL Rails Apps

GIT for THL Rails Apps

Contributor(s): Andres Montano, Jed Verity

Repositories

Applications already in github

Already configured in dev.thlib.org (in master branch): Dictionaries, KMaps, MMS, Places. Already configured in staging.thlib.org (in staging branch): Dictionary, KMaps, MMS, Places. Already configured in thlib.org (in stable branch): Dictionary, KMaps, MMS, Places

Plugins already in github

Note: It may make the most sense NOT to check out these plugins from these repositories to work on them, but to check them out as submodules of the individual apps (kmaps, mms, or places) instead. See the instructions for "Working with an Existing Repository" below.

Importation of a New Project

Getting and Pushing the Code – Working with a Local Repository

1. Getting a local repository. Make sure to use the private URL (git@github.com…) for your development machine to allow you to push your changes back to the GitHub repository. If cloning doesn't work, contact Andres to be added as a collaborator to the repository.

2. Staging and committing changes to the local repository on your development machine. If you are working with plugin (aka submodule) code, see the special "Modifying Plugins" instructions below.

3. Pushing changes to remote repository (GitHub):

4. Getting changes from remote repository (GitHub):

Modifying Plugins

It might make the most sense NOT to check out plugins from their individual repositories, but to work with them as submodules of the individual apps (kmaps, mms, or places) instead. If you have cloned any of these apps, you automatically pulled down the plugin code when you did "git submodule update." Just be sure to follow these steps before making any changes.

Getting the proper version of the plugin code

1. Go into the plugin folder, for example:

2. Check the remote repository URL:

3. If origin is pointing to a read-only URL (i.e. does not start with git@), change it to private URL. If its already pointing to private URL, you should skip this step. Doing this won't change the submodule URL; it will still point to the public URL, but now it will allow you to commit changes directly from your clone repository.

4. Confirm what branch you are in.

5. If you are not in master, but in "(no branch)", then you should check out master. If you are in master, you should skip this step. This has to be done before you make your changes or you'll lose them.

Applying your plugin code changes

1. Push plugin code back to the remote repository. While in the plugin directory (e.g. vendor/plugins/mms_engine), do the following:

2. Push the plugin changes for the whole app project itself:

3. Update the app project with all the latest code:

Applying your plugin changes to other projects that use the same plugin:

1. Check out the project and go to the plugin folder. For example:

2. Confirm what branch you are in:

3. If you are not in master, but in (no branch), then you should check out master. If you are in master, you should skip this step. This has to be done before you make your changes or you'll lose them.

4. Pull changes:

If that doesn't work, try merging the changes:

5. Push the reference to the latest release for that plugin/submodule:

6. Update all changes:

Managing Branches

Creation

Tracking a Specific Branch in the Server

Merging Changes in master to a branch

Reseting the Working Copy back to how it is in the Repository

In order to delete new files that you don't want in the repository run:

Check if your in master:

If you are in no branch run:

else you can simply run:

How to Remove a Submodule

Note: Do not put a trailing slash at the end of path. If you put a trailing slash at the end of the command, it will fail.

Provided for unrestricted use by the external link: Tibetan and Himalayan Library