Git workshop notes.
init
: initialize folder as git repostatus
: see what is going on in the repoadd
: add changed file(s) to staging areacommit
: commit the added file(s) from the staging areadiff
: looks at differences between commitslog
: looking at all your previous messageslog --oneline
: look at condensed version oflog
HEAD
: where you are currently lookingcheckout
: move yourHEAD
around
remote
: somewhere yourgit
repo is stored (e.g. GitHub)origin
: the default you give your remote
push
: sending local changes to remotepull
: receiving changes from remote
-
branch <branch_name>
: create a new branch -
checkout <branch_name>
: move to that branchcheckout -b <branch_name>
: create and move at the same time
-
branch -a
: see what branches are there -
log --oneline --graph --decorate --all
: what is going on -
branch -d
: delete a branch that was mergedbranch -D
: force delete a branch that was not merged
rebase <branch_name>
: incorporate changes in <branch_name>, e.g.master
into current branch, e.g.project_template
- You perform this command on the feature branch, not on
master
.
- You perform this command on the feature branch, not on