Created by Baptiste Leduc for Weglot
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 details:
name, author, date, description
It store, for each branch, the last commit you pushed to them.
Pulling changes from distant remote for all branches. It's updating references for this remote & all related branches.
git pull
git fetch
git merge
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 --pretty=format:"%h %s" --graph
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