Skip to content
Matias Mora-Klein edited this page Jul 21, 2014 · 10 revisions

This is a reference guide on relevant git commands to use and maintain this repository. For more extended reference you may want to visit the following public tutorials:

Setup your github account:

Sign up in github -> Edit your profile -> SSH Keys -> Add SSH Key (Upload your public SSH key).

Create

You can create repositories in your own account, or in an organization that you are a member of. In this case we have created the ACS repository under ACS-Community organization.

Clone

To clone a repository:

mac - ~ $  git clone username@host:/path/to/repository

To clone the ACS repository:

mac - ~ $  git clone git@github.com:ACS-Community/ACS.git

This command will create a folder in your local file system with the ACS repository.

Add & Commit

You can propose changes (add it to the Index) using

mac - ~ $  git add <filename>

or

mac - ~ $  git add *

or

mac - ~ $  git add .

This is the first step in the basic git workflow. To actually commit these changes:

mac - ~ $  git commit -m "Commit message"

Now the file is committed to the HEAD, but not in the remote repository yet.

Push

To send those changes to your remote repository:

mac - ~ $  git push origin master

Change master to whatever branch you want to push your changes to.

Pull

To update your local repository to the newest commit:

mac - ~ $  git pull

Tags & Releases - git

It's recommended to create tags for software releases. For example this line will show you the existing tags in your repository:

mac - ~ $  git tag

To create a new tag:

mac - ~ $  git tag -a v0.1 -m 'Initial version'

Switch the local copy to a specific tag:

mac - ~ $  git checkout tags/<tag_name>

Tags & Releases in Github

Github provides a easy way to create tags & releases: after commit & push the changes, you can create new tags & releases using the web interface: Creating Releases.

Submodules

Git has something called submodule support. This allows you to specify one or more other git repositories within another (like svn:externals):

mac - ~ $  git submodule add git@git.example.com:other_project.git 
mac - ~ $  git commit .gitmodules other_project -m "Added other_project submodule" 
mac - ~ $  git push 

Cloning a tree with submodules

Git doesn’t automatically fetch all your submodules, to add to your local directory:

mac - ~ $  git submodule init git@github.com:jantogni/testing.git
mac - ~ $  git submodule init
mac - ~ $  git submodule update

To git clone including submodules directly:

mac - ~ $  git clone --recursive git@github.com:jantogni/testing.git

Pull latest of all submodules

To pull the latest version of each submodules:

mac - ~ $  git submodule foreach git pull origin master
mac - ~ $  git commit -am "Pulled down update to ..."

Clone this wiki locally