Versioning LPCXpresso projects with Git

LPCXpresso and GIT

Author: fjrg76 at gmail dot com

Date: 03-Aug-17

Tools: Linux Mint 18.2, LPCXpresso 8.2, Git 2.7.4, https://bitbucket.org/

Introduction

I’ll will explain the procedure I followed to make LPCXpresso and Git work together. I’m not an expert, but with those steps I was able to versioning a workspace and share it between two computers: although I’m the only user, I use to work with two or more computers for the same project.

1 LPCXpresso side

Create a LPCXpresso’s workspace and place on it everything you need: system libraries, the RTOS library, your own libraries, and of course, your projects. Make shure your main project compiles, and perhaps, it works as expected.

Once you’re happy with your workspace, clean it! We don’t want to version binary files.

2 GIT side

2.1 Git project in your favorite versioning platform

Create a Git project in your favorite platform. Mine is Bitbucket. For this step I use the web version, but advanced users might do it through the command line. Copy the internet address that your platform has set for your repo, for example:

https://your_user@bitbucket.org/your_user/myproject.git

2.2 Git project for your workspace

ALL FILES IN THE WORKSPACE NEED TO BE VERSIONED (except the binaries). Open a command line and move to the your workspace’s root folder. Once there create a repo (pay attention to the dot after the command git add):

$ git config user.email "your_user@email.com"
$ git config user.name "your_name"
$ git init
$ git add .
$ git remote add origin https://your_user@bitbucket.org/your_user/myproject.git
$ git commit -m "Initial commit"
$ git push -u origin master

2.3 .metadata workaround

After this last step your source code is already in your favorite Git manager, check it out!. However, we have not finished yet. If in this very moment you clone this new repo into a new location, or into another machine, you will not be able to see the projects in your workspace. In order to make it work as expected:

  1. Clone the project into a new location in the machine you are working right now, and do not open LPCXpresso. Let’s call this clone “your working copy version” (because after step 3 you might use it as it):
    $ git clon https://your_user@bitbucket.org/your_user/myproject.git
  2. Copy the .metadata hidden folder from the original LPCXpresso workspace location to your working copy). For this you can use the command line or the file browser in your Linux box.
  3. Update your repo. For the folder .metadata to be added to the main branch you need to exercise a push from your working copy:
    $ git add .
    $ git commit -m ".metadata hidden folder workaround!"
    $ git push -u origin master

3 Start clonning!

If we were luck, then we can start to clone the workspace repo into other machines, or other locations, or for other users. Let’s test if a clone works in LPCXpresso:

  1. Clone the project into a temporary location.
  2. Open LPCXpresso and make it point to the temporary clon.
  3. You should be able to see the projects in your workspace. Without the steps in Section §2.3 you will not see the projects.
  4. You might delete this temporary clon and start versioning in your “copy working”. You can also, of course, take this temporary copy as your working copy and delete the other one. Whatever it’s easier for you.
  5. You can start your versioning workflow from here.

4 Versioning tools for Eclipse

There exist a nice plugin for versioning in Eclipse: EGit. Its corresponding tutorial can be found here.


Let me know if this instructable works for you.

 

 

 

Anuncios

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s