Open console
git init --bare bare-workshop
git init workshop
We will use `fortune` to create content
cd workshop
fortune > first
git add -p first
git add first
for pro
git commit
Add some content to file
fortune > first
Show that change cat first
or better lets use diff git diff
and revert it to commited state git checkout first
git checkout -p first
git have powerfull branching model
show branch in repo
git branch
git branch awesome-branch
delete branch (if it is merged) git branch -d awesome-branch
delete unmerged branchs git branch -D awesome-branch
Create branch and checkout to it
git branch new-branch
git checkout new-branch
or shortcut git checkout -b newer-branch
and add some commitsat lease 4 with 2 commits
git checkout -b master
git merge [branch-name-here]
simple merge git mergetool
git merge [first-branch] [second-branch] [thid-branch]
git cherry-pick [commit-id]
Some command in git could be very long
git log --graph --oneline --branches
It would be very nice to have command to do it git graph
It is possible git config alias.graph "log --graph --oneline --branches"
after this we can usegit graph
We can run even programs from
git config alias.sbt '!sbt'
! here means run it in shell git clone [my-ip-address]
How to get new data in our repository ?
git fetch origin
It can takes not only remotes butIt compilation of
Send changes to remote repository
git push [remote] [branch]
push have nice switch --set-upstream git push [remote] [local-branch]:[remote-branch]
git push [remote] :[remote-branch]
git rebase master feature
Used to find bug in large codebase (linux-kernel)
git bisect start HEAD HEAD~99
git bisect run "./check"