Difference between revisions of "Introduction to Git for Development"
(→Setting up Git in a project directory: Minor additions) Tags: Mobile web edit Mobile edit |
|||
Line 24: | Line 24: | ||
<code>git init</code> | <code>git init</code> | ||
+ | |||
+ | this initialises the repository and adds a hidden <code>.git</code> directory which will contain the archived project versions. | ||
+ | |||
+ | === Setting a Remote Address === | ||
+ | In order to be able to upload your project onto GitHub (or any other Git hosting site) you need to create a repository (see below) and then copy the clone URL. | ||
== Creating a RailOS Project with Git == | == Creating a RailOS Project with Git == |
Revision as of 22:57, 26 August 2022
Git is a free and open source version control software which is used for projects under the Railway-Op-Sim GitHub Organisation. When developing code or raw text based projects version control provides an essential means of storing, iteratively, changes made to files allowing the user to restore a project to a previous state should the need arise to reset it. Git also allows multiple developers to work on the same project simultaneously without risk of changes clashing. A project using Git for version control is called a repository.
Developing with Git
There are two main ways to interact with Git, using a Graphical User Interface (GUI) based application such as GitHub Desktop, or the command line interface (CLI).
Development with GitHub Desktop
For those less familiar with using the command line, GitHub provides an application for interacting with repositories hosted on their service. The software is available here.
Installing Git CLI
Git for Windows is available to download on the software website.
When installing the software it is recommended that the Use MinTTY (the default terminal of MSYS2)
option be selected as this provides a Unix BASH style terminal which is easier to use compared to the default cmd.exe
application. After installation the Git Bash application is available within the start menu.
Introduction to Git CLI
Setting up Git in a project directory
When setting up a Git project make sure you are in the root (top level) directory for your project and run the following command:
git init
this initialises the repository and adds a hidden .git
directory which will contain the archived project versions.
Setting a Remote Address
In order to be able to upload your project onto GitHub (or any other Git hosting site) you need to create a repository (see below) and then copy the clone URL.