Git

From Teknologisk videncenter
Revision as of 15:57, 20 December 2022 by Heth (talk | contribs) (Why is it called Git?)
Jump to: navigation, search

Install git

Download git from https://git-scm.com/download/win and install it.

Learn basic git by watching this video tutorial: Learn git in 3 hours

Basic configuration

From terminal issue the following commands: (Windows start the git bash app)

git config --global user.name "Henrik Thomsen"
git config --global user.email "heth@mercantec.dk"

It will create a ~/.gitconfig file for the user

Create a new git project

mkdir project
cd project
git init

git init will create a .git directory

File tracking states

A specified file can be in one of four states

State Explanation
Untracked The file is not tracked by git and changes are not recorded
Unmodified The file is tracked by git and has not changed since it's last commit
Modified The file is tracked by git and has changed since it's last commit
Staged means that you have marked a modified file in its current version to go into your next commit snapshot.

File tracking lifecycle

Files can change state issuing git commands

Basic git commands

Why is it called Git?

Linus Torvalds has quipped about the name "git", which is British English slang for a stupid or unpleasant person. Torvalds said: "I'm an egotistical bastard, and I name all my projects after myself. First 'Linux', now 'git'."[1][2][3]

References