Skip to content

How to version your project?

When working on a project, it is important to version your work. Even on your own! 😄

The reasons are simple:

  • Go back if you make a mistake or a botched implementation
  • Have several versions: testing, stable…
  • Manage issues (tasks)

That said, versioning your project is not mandatory. It is a plus for you (a professional skill).

Prerequisites

You must already have:

To version the project:

1/ Create a new empty repository with your GIT provider (Github, GitLab ...)

Important information

Please note that the repository must be EMPTY when it is created. Otherwise, you will have trouble pushing your files.

2/ Open a terminal and go to the root of the project

3/ Type the following lines:

  • Initialize the project
git init
  • Add the URL of the GIT repository (HTTPS or SSH)

Important information

Replace URL_GIT_REPO with the URL of the repository you created

Copy the URL shown in the repository's GIT service

Here is an example:

git remote add origin git@github.com:studoo-app/edu-framework.git

This is only an example and it will probably not be yours. Here we selected the SSH protocol to link to the repository. You can also use the HTTPS protocol. SSH is more secure and faster than HTTPS. However, it requires extra configuration on the machine, including installing an SSH key. Example of SSH configuration: Github SSH

Screen Start Edu App

git remote add origin URL_GIT_REPO
  • Add the "main" branch
git branch -M main
  • Add the files to the commit
git add * .gitignore .env.example
  • Add the 'init project' commit
git commit -m 'init project'
  • Push the local files to the remote repository
git push -u origin main

Push errors

If you get errors when pushing, here are a few commands to help you:

Show the URLs of the GIT repositories configured in your project:

git remote show origin

To remove the origin URL already configured in your GIT:

git remote rm origin