Wiki

Clone wiki

VIT-Projects / git

Basic Git Setup

Global Setup

Before any git activities can be done on a machine you need to "introduce yourself" give your name and email to git.

$ git config --global user.email "yourname@youraddress"
$ git config --global user.name "FName LName"

In addition it is also important that we are setup to guard against CRLF headaches

Repo Setup

Once above is done you need to have a repo. This typically is done in one of two ways: clone or create.

Clone

One typically makes a git repo copy from some on bitbucket or github using git clone <repo-url>

Create

To create:

  1. cd into an existing codebase
  2. $ git init
  3. Pre-Init setup (see below)
  4. $ git add .
  5. $ git commit -m "Initial Commit

Pre-Init Setup

Consists of creating files .gitignore .gitattributes and any other repo-config. More details: CRLF Headaches

Help

$ git help topic will give help on topic.
$ git help -w topic may be preferable.
For that yout need to $ apt-get install git-doc

More Advanced/Arcane

Merge vs Rebase

https://medium.com/@porteneuve/getting-solid-at-git-rebase-vs-merge-4fa1a48c53aa

Cleanup a repo

http://stackoverflow.com/questions/9683279/make-the-current-commit-the-only-initial-commit-in-a-git-repository

Hg Git Rosetta Stone

https://github.com/sympy/sympy/wiki/Git-hg-rosetta-stone#git__hg_conversion

Updated