2 Workspace
Fede.- edited this page 2023-08-07 01:48:17 +00:00

Preparing the workspace

The first thing we need to do is "cloning" the repository, this means making a local copy of the remote files. All the work will be done on this copy.

01. Cloning the repository

A Git repository is a project folder containing the files created or to be translated and the detailed track history of those changes.

To clone the repository, we need to open a terminal in the directory we would like to clone the repository to. Once there we will use the git clone command, an instruction to clone a repository by typing its address. In our case it would be:

git clone https://git.disroot.org/Disroot/Howto

Once the repository has been copied to our hard drive we will see a Howto directory containing all the files of the project. It can be later moved to any place on our computer.

Setting our identity

Once we have copied the repository to our machine, we can start creating, editing and/or translating a howto. But it is recommended to setup our identity first, that is our username and an email. This information is used by Git to "sign" the commits (the "snapshots" of our modifications) and it is necessary to be able to send our work back to the remote repository.

  1. We open a terminal in (or navigate to) the directory/folder where we have the cloned repository.

  2. Write and complete with our information the following commands:

git config --global user.email user@email <- here goes our email address

git config --global user.name "Username" <- and here our username

We will not need to enter this information again. When we submit our modifications, we will first be asked to enter our "Forgejo" account password.

02. Creating a branch

We have cloned the repository, the next step will be to create a branch.

Every Git project, the Howto's project in this case, has a main branch (or master branch) which contains all the files we can see online or in production. The changes we apply on this branch are automatically synced with the site, and become visible immediately. And that is the reason why adding any changes to this main branch is restricted to the owners of the project.

In general terms, a branch is basically an independent workspace created from the main line of development on which we can work and test things without compromising the original code.

In the terminal, to create a new branch from the main one and switch to it we will use the git branch command like this:

git branch -b our.branch.name

In code/text editors such as Pulsar and VSCodium, there is an option to create and manage branches with just a few clicks.

To learn more about working with editors, please check this tutorials.

When creating a new branch, we suggest to give it a name descriptive enough so that others can easily figure out what we are working on when they see it.

Ok. We have everything ready to start working.