My Git/GitHub notes

Started 26Oct2017, updated 1May2021

This page is in group Technology (plus My XMOS pages) and is a blog note about my usage of Git in the context of the XMOS xTIMEcomposer Studio.

I am posting this here because I work alone, being retired and away from the guys I used to ask. Now I can ask this note!-) I have no Pull Requests to think about. So far I only have local Git repositories and I have used  GitHub only to fetch other people’s code.

I use Git because it’s nice to have the history at my fingertips.

xTIMEcomposer .git repository directory

The Git repository directory is not visible in xTIMEcomposer. (The repository itself is of course visible, it’s in some of the Console view’s tabs). It is a hidden directory called .git (standard by Git), residing at the same level as bin and src. You will see it in Finder (I use a Mac) if you have made hidden directories visible:

In Sierra (macOS 10.12, 2016) it’s a keyboard shortcut, see How to show hidden files and folders including ~/Library on a Mac (Macworld):

Hold down Cmd + Shift + . (dot)

I just updated to High Sierra (from El Capitan) and it’s a beautiful function! And easy to remember: “make dot files visible or not”: cmd shift dot!

On older macOS (OS X) you’d have to do it in Terminal. It’s described in How to show hidden files in Finder (OS X 10.9)?

defaults write AppleShowAllFiles 1

Using git commands to make a local git repository

I asked about this at the XCore Exchange forum (by XMOS): How to move files into newly made git repository

The short answer is that it cannot be done from inside xTIMEcomposer. Larry wrote (I have modified line 2):

If you turn individual projects inside your workspace into Git repositories, xTIMEcomposer will pick these up and give you a graphical interface to manage them:

git init
git add Makefile src/*.xc src/*.c src/*.h src/*.cpp
git add *.xn *.xscope

(list here or use “Add to index” in xTIMEcomposer later on)

git add .cproject .project
git commit -m Initial

inside each project’s directory. You might not want the project files under source control, as they change quite frequently.

I added src/*.c. To get to this then start Terminal and cd to the project directory (just below workspace) and run the commands.

When you gave done this you should have a .git directory at the same level as bin and src.

To tell xTIMEcomposer about it you’ll have to do Team | Share Project.. and select the new Git respository you just made. Alternatively “Add an existing local Git repository to this view” (see below) I guess. However, when I have done this and do Compare With | HEAD Revision then that HEAD revision is empty. But if I do a new Team | Commit and select files by hand (because they are all unticked of course) I do get a HEAD revision, without any diff… hmm. Maybe that initial HEAD revision should be empty?

Using GitHub Desktop to make a local git repository

It’s also possible to use the GitHub Desktop:

File | Add Local Repository

I then did a commit telling that it was first and that I had used the GitHub Desktop.

You will also have to tell xTIMEcomposer about this. I opened the Git Repositories tab in a Console view. I then did this:

Add an existing local Git repository to this view

I let xTIMEcomposer know where .git was. I could inspect the initial commit in the Git Reflog tab and there was the initial commit.

I then did a commit as usual in the IDE, on the project, like this:

Team | Commit

xTIMEcomposer Code Under Version Control

I found this by ahogen:


Do you need to keep your code under source/revision control with a solution like Git, Subversion (SVN), Mercurial? Are you using an Eclipse-based IDE like xTIMEcomposer (XMOS) or Code Composer Studio (Texas Instruments) and hate all the /.metadata junk that should stay far away from your precous (sic) code?


Wikipedia: Git

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.