Git basic commands

Git basic commands
Theme: 
Sciences and technics
Usage presentation: 

One can create training repository to test and understand exercise :

cd /tmp
mkdir git_essais
cd git_essais/
mkdir remote_dir
mkdir locale_dir
cd remote_dir/
git init --bare biblio1.git
git init --bare prod1.git
cd ../locale_dir
git clone file:///tmp/remote_dir/prod1
git clone file:///tmp/git_essais/remote_dir/prod1.git/
git clone file:///tmp/git_essais/remote_dir/biblio1.git/
cd prod1/
echo "$PWD:line1" >>prod1_1.txt
echo "$PWD:line1" >>prod1_2.txt
git add prod1_1.txt
echo "$PWD:line1" >>prod1_3.txt
git commit -m "adding prod_1_1.txt"

Automate type: 
Lesson
Audience: 
public
English

Tags:

Lesson level: 
Basic
Rules and exceptions: 
Regular items: 

does "git reset --soft" change index?%*N*(#precision=Y/N)%7%More(#link=git-scm.com/docs/git-reset)
does "git reset --soft" change working directory?%*N*(#precision=Y/N)%7%More(#link=git-scm.com/docs/git-reset)
Different modes of git reset?%*hard* *keep* *merge* *mixed* *soft*(#precision=Modes in alphabetic orderModes without --)%7%More(#link=git-scm.com/docs/git-reset)
does "git reset --hard" change index?%*Y*(#precision=Y/N)%7%More(#link=git-scm.com/docs/git-reset)
does "git reset --hard" change working directory ?%*Y*(#precision=Y/N)%7%More(#link=git-scm.com/docs/git-reset)
does "git reset --mixed" change index?%*Y*(#precision=Y/N)%7%More(#link=git-scm.com/docs/git-reset)
does "git reset --mixed" change working directory?%*N*(#precision=Y/N)%7%More(#link=git-scm.com/docs/git-reset)
Add a branch from a local repository to current repository%git *remote* *add* *-m* *my_branch* *my_repo* *file:///path/to/my_repo.git*(#precision=my_branch/path/to/my_repo)%7%More(#link=git-scm.com/docs/git-add)
add forgotten file "foo" on last commit%git *commit* *--amend* *foo*%7%More(#link=git-scm.com/docs/git-commit)
Dispaly remote repositories%git *remote* *-v*%8%More(#link=git-scm.com/docs/git-remote)
git help%git *help*%7%More(#link=git-scm.com/docs/git-help)
add index to last commit%git *commit* *--amend*%7%More(#link=git-scm.com/docs/git-commit)
changing branch%git *checkout*%7%More(#link=git-scm.com/docs/git-checkout)
come back to actual modifications after git stash%git *stash* *pop*%8%More(#link=git-scm.com/docs/git-stash)
come back to last commit%git *reset* *HEAD*%7%More(#link=git-scm.com/docs/git-reset)
commit all tracked files%git *commit* *-a*%7%More(#link=git-scm.com/docs/git-commit)
index commit%git *commit*%7%More(#link=git-scm.com/docs/git-commit)
commit all current modifications%git *commit* *-a*%7%More(#link=git-scm.com/docs/git-commit)
create central repo named "my_repo"%git *init* *--bare* *my_repo.git*%7%More(#link=git-scm.com/docs/git-init)
create local repo from "my_url"%git *clone* *http://my_url*%7%More(#link=git-scm.com/docs/git-clone)
create local repo from local directory "/path/to/my_repo.git"%git *clone* *file:///path/to/my_repo.git*%7%More(#link=git-scm.com/docs/git-clone)
create tag "foo" on commit "sha"%git *tag* *foo* *sha*%7%More(#link=git-scm.com/docs/git-tag)
create branch "BUG_7"%git *branch* *BUG_7*%7%More(#link=git-scm.com/docs/git-branch)
create tag v02 sur 5sdf4%git *tag* *v02* *5sdf4*%7%More(#link=git-scm.com/docs/git-tag)
create central repository%git *init* *--bare*%7%More(#link=git-scm.com/docs/git-init)
create local repository from central one%git *clone*%7%More(#link=git-scm.com/docs/git-clone)
delete tracked file foo%*rm* *foo*; *git* *rm* *foo*%7%More(#link=git-scm.com/docs/git-rm)
display git help on command my_cmd%git *my_cmd* *--help*%7%More(#link=git-scm.com/docs/git-help)
current directory state%git *status*%7%More(#link=git-scm.com/docs/git-status)
file state A%state of file is *commited*%5%More(#link=git-scm.com/docs/git-commit)
file state B%state of file is *modified*%5%More(#link=git-scm.com/docs)
file state C%state of file is *stagged*%5%More(#link=git-scm.com/docs)
file state D%state of file is *commited*%5%More(#link=git-scm.com/docs)
git command%git *add*%3%More(#link=git-scm.com/docs/git-add)
git command%git *checkout*%2%More(#link=git-scm.com/docs/git-checkout)
git command%git *commit*%1%More(#link=git-scm.com/docs/git-commit)
git command 1%git *add*%4%More(#link=git-scm.com/docs/git-add)
git command 2%git *commit*%4%More(#link=git-scm.com/docs/git-commit)
git command 3%git *commit* *-a*%4%More(#link=git-scm.com/docs/git-commit)
git command 4%git *checkout*%4%More(#link=git-scm.com/docs/git-checkout)
git notion 1%this directory is the *working* directory%6%More(#link=git-scm.com/docs)
git notion 2%this is the *stagging* *area*%6%More(#link=git-scm.com/docs)
git notion 3%this is the *repository*%6%More(#link=git-scm.com/docs)
In the command "git clone xxx://yyy@zzz/aaa" what's aaa%aaa is the *sub-directory* in *user's home*%8%More(#link=git-scm.com/docs)
In the command "git clone xxx://yyy@zzz/aaa" what's xxx%xxx is the *protocole*%8%More(#link=git-scm.com/book/fr/Git-sur-le-serveur-Protocoles)
In the command "git clone xxx://yyy@zzz/aaa" what's yyy%yyy is the *user*%8%More(#link=git-scm.com/book/fr/Git-sur-le-serveur-Protocoles)
In the command "git clone xxx://yyy@zzz/aaa" what's zzz%zzz is the *url* of the *repository*%8%More(#link=git-scm.com/book/fr/Git-sur-le-serveur-Protocoles)
List changed files between two commit xxx yyy %git *show* *--name-only* *xxx* *yyy*%8%More(#link=git-scm.com/docs/git-show)
List current directory modified files since last tag v01.01%git *show* *--name-only* *v01.01*%8%More(#link=git-scm.com/docs/git-show)
list files name from directory and sub-directory "my_dir" for the commit "sha"%git *ls-tree* *--name-only* *-r* *sha* *my_dir*%7%More(#link=git-scm.com/docs/git-ls-tree)
list files name from directory and sub-directory "my_dir" for the tag "my_tag" G%git *ls-tree* *--name-only* *-r* *my_tag* *my_dir*%7%More(#link=git-scm.com/docs/git-ls-tree)
list indexed files%git *ls-file*%7%More(#link=git-scm.com/docs/git-ls-files)
branches list%git *branch* *-l*%7%More(#link=git-scm.com/docs/git-branch)
tags list %git *tag* *-l*%7%More(#link=git-scm.com/docs/git-tag)
local repository and staging area diff%git *diff* *--cached*%7%More(#link=git-scm.com/docs/git-diff)
local repository and working directory diff%git *diff* *HEAD*%7%More(#link=git-scm.com/docs/git-diff)
main git protocols%*file* *git* *http* *ssh*%7%More(#link=git-scm.com/book/fr/Git-sur-le-serveur-Protocoles)
put file in git %git *add* *bar*%7%More(#link=git-scm.com/docs/git-add)
repository cleaning%git *gc*%7%More(#link=git-scm.com/docs/git-gc)
other name for index%*stagging* *area*%6%More(#link=git-scm.com/docs/git-clone)
other name for stagging area%*index*%6%More(#link=git-scm.com/docs/git-clone)
other state name than indexed for file C%the other name for indexed is *stagged*%5%More(#link=git-scm.com/docs)
other state name than stagged for file C%the other name for stagged is *indexed*%5%More(#link=git-scm.com/docs)
preserving actual modifications, go back to last commit%git *stash*%7%More(#link=git-scm.com/docs/git-stash)
renaming foo to bar%git *mv* *foo* *bar*%7%More(#link=git-scm.com/docs/git-mv)
switching to branch "DVP"%git *checkout* *DVP*%7%More(#link=git-scm.com/docs/git-checkout)
updating central repo from local repo %git *push*%7%More(#link=git-scm.com/docs/git-push)
updating local repo from central repo %git *pull*%7%More(#link=git-scm.com/docs/git-pull)
updating local repo from other repo %git *fetch*%7%More(#link=git-scm.com/docs/git-fetch)
displaying modifications in working directory since last commit%git *diff* *HEAD*%7%More(#link=git-scm.com/docs/git-diff)
displaying modifications in working directory from index%git *diff*%7%More(#link=git-scm.com/docs/git-diff)
displaying modifications in next commit%git *diff* *--cached*%7%More(#link=git-scm.com/docs/git-diff)
What does mean "master"%name of *default* *branch* created with command git *init*%7%More(#link=git-scm.com/docs/git-remote)
What does mean "origin"%name of *repository* *cloned* *from*%7%More(#link=git-scm.com/docs/git-remote)
What's the 4 git object types(#precision=in alphabetical order)%*blob* *commit* *tag* *tree*%10%More(#link=git-scm.com/docs)
which command display%git *remote* *-v*%8%More(#link=git-scm.com/docs/git-clone)
working directory and staging area diff%git *diff*%7%More(#link=git-scm.com/docs/git-diff)

Column marker: 
%
Directive label inductor: 
#
Directive value inductor: 
=
Columns description: 
Column type: 
Text
Header: 
Git question(en)
Column role: 
Master
Column type: 
Text
Header: 
Your answer(en)
Text widget: 
input main words to phrase autocompletion
Column role: 
Minor
Ignore case: 
Ignore case if checked
Ignore accent: 
Ignore accent if checked
Ignore white space: 
Ignore white space if checked
Ignore ponctuation: 
Ignore ponctuation if checked
Column type: 
Image
Header: 
Illustration
Column role: 
Information
Illustrations: 
git objects
Sequence driven: 
piece
Column type: 
Text
Header: 
More information
Column role: 
Information
Image: