cancel
Showing results for 
Search instead for 
Did you mean: 

Where should I initialise Git when creating a CubeIDE project?

CDyer.1
Senior

Hi,

This may be more of a general Git usage question, but I am currently learning how to use Git so I can begin to implement version control with my projects. There doesn't seem to be many examples online of embedded use, it's mostly web stuff. I use CubeIDE exclusively but am learning Git from the command terminal as I also want to learn another skill (using GUIs seems to be cheating a bit). My question is: where would one want to initialise the Git repository when wanting to implement version control in a CubeIDE project? So far I have initialised Git within the project folder itself as seen here:

 0693W00000QOIFkQAP.pngand when I've made any substantial changes, I stage and then commit. Is this the best way to implement? Obviously this will then include all the drivers and other files that are auto generated.

1 ACCEPTED SOLUTION

Accepted Solutions

Debug and Release folders contain build artefacts. The content is changing whenever you clean/build/rebuild your project and usually not tracked by a source code revision tool like git. Anyway, you may have a specific reason doing so.

> uses absolute paths for some things

Check it out by using grep to find (parts of the) absolute path in any config files. In your example project

grep Engineering_Software .* *

For Windows, grep comes with the git bash for example. In most cases you should not find the absolute path. Try checking out your project in a different folder.

hth

KnarfB

View solution in original post

6 REPLIES 6
KnarfB
Principal III

Looks good. In the long run, the auto-generated code will change after a firmware/tool upgrade. So you can perfectly track changes.

Add a .gitignore and exclude Debug/ and Release/ folders from git because they contain the build artefacts.

hth

KnarfB

Thanks for the reply, could you explain a little more about the reasons for excluding Debug and Release? I have seen that Eclipse (and in turn CubeIDE) uses absolute paths for some things and so that can cause errors if someone else was to download and compile this project from GitHub for example?

Debug and Release folders contain build artefacts. The content is changing whenever you clean/build/rebuild your project and usually not tracked by a source code revision tool like git. Anyway, you may have a specific reason doing so.

> uses absolute paths for some things

Check it out by using grep to find (parts of the) absolute path in any config files. In your example project

grep Engineering_Software .* *

For Windows, grep comes with the git bash for example. In most cases you should not find the absolute path. Try checking out your project in a different folder.

hth

KnarfB

Pavel A.
Evangelist III

Debug and Release are build directories created with names of configurations in your Eclipse project.

You can rename configurations or add new, then the Debug & Release will change accordingly.

Everything in these build directories is by-product of build and should not be checked in.

Create a .gitattributes file with a single line: "* -text" to prevent git from tinkering with cr/lf line end translations. It was something from the past century. These days, all decent editors and compilers on Windows understand "unix" line ends.

i do like those build artifacts, specially the .bin and .elf files

we dont need to firmware by ourselves, lets talk

This is the point I was trying to make. If you don't include those in your git repository then it requires whomever needs it in the future to compile themselves before they can program the device. I would have thought it would be beneficial to keep the actual compiled file along with the source. Then again I don't know what I'm talking about, hence the question.