Other
edit the files without editing the message
git commit --amend --no-edit
example
git init
git add .
git commit -m "initial commit"
git remote add origin https://github.com/s3/aw33.git
git push -u origin master
diff
git diff
affiche le diff qui existe entre differents snapshot. snapshot can be the working tree, the index, or a tree.
we may show information about a commit, including the diff, wit the git show command. It shows information about the last commit by default.
git show
prune .git folder, prevent some safeguards
clean : supprimer aussi les untracked files et folders
git clean -df
supprime les untracked files et directories. En effet, git checkout . ne permet pas de supprimer les fichiers et directories qui sont untracked, ramene a leur ancienne version seulement les fichiers tracked.
log commits, forks and merges
we log the commits of the current branch
git log
we may display the forks and merge commits
git log --graph --oneline
head
Head is which commit the working tree is coming from.
We change the head by checking out a specific commit.
When we check-in a commit that is not tracked by any branch, we say the head is detached, probably meaning detached from any branch.