git cli

To backup my arduino sketches I will use a remote git repository hosted on my own server. So lets start

  • git init – initialize a new local repository
  • git clone @: – check out/clone from a remote reporitory

The local repo is devided into a working copy, the index as interim stage und the head which is a link to the last commit.

  • git add – add a file to local repository
  • git commit -m “
  • git push origin master – sync local repository with remote repo

If the local repo was not cloned but should be linked to a remote repository use:

  • git remote add origin

To sync the local repository use:

  • git pull – fetch remote changes and merge them with the local files
  • git add – inform git about solved merge problems after solving

Summary:

git init

git add .

git commit -am “

git remote add origin @:

git push -u origin master

create git repo and connect using eclipse

In order to keep my software developments in line and keep access also from remote sides I decided to use git on one of my servers and use eclipse for the development itself. So to add or create a new repository I follow this steps:

– create new directory: mkdir <repo>

For convenience I use a naming as: repo-<section>-<subsection> (e.g. repo-php-project)

– change to the newly craeted directory: cd <repo>

– initailize a bare git repo: git init –bare

This will fill in a repo with the administrative stuff inside but without any further details. Those will come with the first clone/commit.

– clone the empty repo from within eclipse using the import function: Project perspective -> Import -> Git repository -> New Project

This will create a new project within eclipse based on the newly created git repo.