Skip to content

TECH TALK 8 GIT BASICS

Piotr Dybowski edited this page Jan 22, 2019 · 1 revision

Agenda:

  1. What is Git?
  2. How to GGG (Get Git Going)?
  3. Day-to-day commands

What is Git?

Distributed version control system with staging areas, local branching, multiple workflows and much more! :)

Get Git Going

git init -> new repo

git clone -> existing repo

.gitignore

gitconfig

Multiple level config: /pat_to_your_repo/.git/config > ~/.gitconfig > /etc/gitconfig

sections

[user]
    email = [email protected]
    name = Piotr Dybowski
[core]
    editor = vim 
    ...
[push]
    ...

[alias]
    ...

aliases

[alias]
    my-commits-last-month = !git log --after={`date -d -0month  "+%Y-%m-01"`} --author=\"dybowski\" --pretty=format:\"%cd  %h  %s\" --date=short --branches --no-merges
    s = status -sb 
    st = stash
    stp = stash pop 
    one = log --oneline
    co = checkout
    ci = commit
    cia = commit -a
    rh = reset --hard HEAD
    pf = push --force-with-lease
    br = branch
    desc = describe

local vs global

git config -l --local git config -l --global

Day-to-day commands

  1. git help
  2. git status
  3. git log -> git one (one = one = log --oneline)
  4. git fetch
  5. git pull
  6. git merge
  7. git checkout
  8. git branch
  9. git add
  10. git commit (-a, --amend)
  11. git rebase
  12. git branch

In next episode:

  1. git rebase vs git merge
  2. git reflog
  3. git reset
  4. git push vs git push --force vs git push --force-with-lease

MORE

https://git-scm.com/book/en/v2

Video

https://drive.google.com/drive/u/0/folders/1iItjh9xgWLNM2BJeHmRLAuadp_ol_349