My Git/GitHub notes

Started 26Oct2017, updated 8Nov2017

This page is in group Technology 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):

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 com.apple.finder 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:

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

git init
git add Makefile src/*.xc src/*.h
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.

To get to this then start Terminal and cd to the directory and run the commands.

When you gave done this you should have a .git directory at the same level as bin adn 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.

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

References

Wikipedia: Git

Email this to someoneShare on FacebookTweet about this on TwitterShare on LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy This Password *

* Type Or Paste Password Here *

13,212 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>