Git

the stupid content tracker - basics

 

Sascha Spreitzer | sspreitz@redhat.com

Linus Torvalds

7th April 2005

Linux Kernel

Bitkeeper replacement

N to N Architecture

Creating a repository

$ git init myfirstrepo

Cloning a repository

 

$ git clone https://github.com/sspreitzer/fedora-docker

$ git clone /tmp/git/test1

$ git clone /tmp/git/test1 mytest
Adding files

$ echo hi > file

$ git add file

$ git commit -m 'Initial project version'

Removing files

$ git rm file

$ git commit -m 'file removed'
Recording changes

$ editor file

(change the file)

 

$ git commit -m 'new changes'

Viewing current changes

$ editor file

(change the file)

 

$ git diff

Viewing last commit

$ git show
Viewing the commit log

$ git log
Undo last commit

$ git commit --amend

$ editor file

$ git commit -m 'added feature'

Remotes

$ git clone ssh://me@example.com/repo.git

$ cd repo

$ git remote

origin

Viewing remotes

$ git remote -v

origin /tmp/git/repo (fetch)

origin /tmp/git/repo (push)

Adding remotes

$ git remote add newremote https://github.com/r/user/repo.git

 

$ git remote

origin

newremote

Removing remotes

$ git remote rm newremote

$ git remote

origin

Pulling from remote

$ git pull

$ git pull origin

$ git pull newremote

Pushing to remote

$ git push

$ git push origin

$ git push newremote

THANK YOU!