Created by Baptiste Leduc for JoliCode
Your local git is a repository
Distant git is a repository (and you can have multiple distant git, for example when using forks)
Each repository have their own branches, you won't recover them by simply fetching a repository
A lot in theses !
You always have a HEAD when on a branch
It contains a reference to the last commit of that branch
Points to a commit with some metadatas:
name, description
author & date are already embed with commits
Pulling changes from distant remote for all branches. It's updating references for this remote & all related branches.
git pull
git fetch
git merge FETCH_HEAD
git merge
To merge a final branch to a develop/master branch
git fetch [remote]
git rebase [remote]/[branch]
Adding one by one is ... borring !
git add -p
git log
Quite easy:
git log --graph --date=relative --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ad)%Creset'
git reflog is decoupled from HEAD and repository. It's just a local history of git.
git reflog
It will move HEAD location (last commit in branch) and keep changes.
Will move HEAD location and remove changes.
Based on HEAD: "HEAD~..."
Based on commit: "c14809fa" (commit hash)
git reset --soft HEAD~0
git reset --soft c14809fa
git commit -m "message"
git commit --amend
git s
git st
...
git oops
git commit --amend --no-edit
git rc
git rebase --continue
&
git rs
git rebase --skip
git lg
git log --graph --date=relative --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ad)%Creset'
[pull]
rebase = preserve
[rerere]
enabled = true
git rerere [diff]