LPCXpresso and GIT
Author: fjrg76 at gmail dot com
Tools: Linux Mint 18.2, LPCXpresso 8.2, Git 2.7.4, https://bitbucket.org/
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:
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 "firstname.lastname@example.org" $ git config user.name "your_name" $ git init $ git add . $ git remote add origin https://email@example.com/your_user/myproject.git $ git commit -m "Initial commit" $ git push -u origin master
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:
- 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://firstname.lastname@example.org/your_user/myproject.git
- 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.
- 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:
- Clone the project into a temporary location.
- Open LPCXpresso and make it point to the temporary clon.
- You should be able to see the projects in your workspace. Without the steps in Section §2.3 you will not see the projects.
- 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.
- You can start your versioning workflow from here.
4 Versioning tools for Eclipse
Let me know if this instructable works for you.