Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git intro

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.

Git intro

Avatar for Denys Kurets

Denys Kurets

October 05, 2018
Tweet

More Decks by Denys Kurets

Other Decks in Programming

Transcript

  1. Опитування • Що таке git • Що таке commit •

    Що таке push/pull • Що таке merge • Що таке rebase • Що таке GitHub • Що таке fork
  2. Git

  3. git init #initialize empty repo git add . #add untracked

    files git status #status git commit -am “init" #commit
  4. git add . #add untracked files git add index.html git

    status #status git commit -m “change content” #commit
  5. git checkout -b new_page #create new branch git add .

    #add untracked files git push origin new_page #publish new branch git branch #list of available branches git checkout master #switch to master branch
  6. git remove add upstream <url> add repo git fetch upstream

    #fetch branches from upstream repo git merge upstream/master #merge changes to local branches git pull # (git fetch and then git merge)
  7. git checkout you_branch . git fetch git rebase master git

    push origin you_branch — force #dangerous
  8. ще команди • git commit -- amend #reword commit message

    (not pushed) • git reset -- hard HEAD~1 #reset to commit • git reset -- soft HEAD~1 #soft reset to commit • git branch -m oldname newname #rename branch • git cherry-pick <commit> #apply commit from another branch • git checkout <file> #revert to last commit • git branch -d <branch name> #delete branch • git blame <commit hash> #see who did canges • git stash