Skip to content
marcello edited this page Nov 27, 2014 · 3 revisions

Introduction

Git is a source code version control system. It's biggest differential is: being distributed, fast and safe, as well as having an opitmized storage system.

Requirements

On Linux Operating Systems it's necessary to install its package.

# aptitude install git

Create a file named ~/.gitconfig on your home directory.

[user]
  name = "Your Name"
  email = email@domain
[alias]
  st = status
  co = checkout
  ci = commit
  br = branch -av
[pull]
  rebase = true
[format]
  pretty = oneline
  abbrev-commit = true
[branch]
  autosetuprebase = always
[push]
  default = simple

Workflow

  1. Select an issue you want to work on if it's not already assigned
  2. Access the master branch
  3. Download the remote modifications to your local directory
  4. Create a new branch
  5. Do your task (modify/create/delete)
  6. Add modified files to send to origin
  7. Commit your solved task
  8. Pull remote modifications and merge them locally
  9. Push your modifications to origin

After you're done with your task:

  • Rebase your branch with the remote master. How to Here

Create a pull-request and on description put a reference to which issue has been solved. Example: "Solve #13"

  • Using github link.

After the pull-request has been created. Another dev will review and aprove the commit.

Common Commands

Clone project

git clone https://github.com/cercomp/weby.git

Show branches

git branch -av

or if you're using the mentioned aliases:

git br

Switching to a branch

git checkout <branch-name>

Create new branch

git checkout -b branch-name origin/remote-branch

We've determined the pattern of a branch name to be the like the following: "13_update_bootstrap"

See modified files

git status

Add the modified files to be commited

git add <file-name>

Create a commit

git commit -m "Put a summary of the modifications here."

Download remote modifications and insert them localy

git pull --rebase

To rebase your branch with the master follow the instructions on: Rebase branch with master

Send modifications to origin

git push

Undo modifications to a file

git checkout <file-name>

List difference of a file to it's original

git diff <file-name>

Update local branches

git remote update --prune

Clone this wiki locally