daver787 / 2021-09-01-git_david

Git tutorial work with Daniel Chen

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2021-09-01: NYR Git Workshop

-git init:initialize git repository in current location -pwd:tell you where you are

  • git status:tells you the git status
  • git add <FILE>:adds to the staging area
  • git commit: opens text editor to commit things in staging
  • git commit -m: lets you write commit message inline
  • git log: shows you the log -git log -oneline:shows you the oneline log
  • git diff: diff current changes to last git state
    • git diff <HASH>/HEAD~:diff current state to another commit
  • git checkout <HASH> <FILE>:revert to the version in
  • git checkout <HASH>: revert eeverything to in a detached HEAD state -git checkout main/git switch main:to go back

Remotes

  • git remote add <NAME> <URL>:add a remote using the
    • git remote add origin origin XXXXX
  • git remote -v : shows you what remotes you have
  • git push <REMOTE><BRANCH>:sends your changes to the remote
  • git pull <REMOTE><BRANCH>:pull changes from remote down to local computer
  • Conflicts may happen during push/pull syncs

Branches

  • git branch <NAME>: create a branch where you are(i.e. head)
  • git branch -a: list all the branches you are on
  • git switch <BRANCH>: newer way to change branches
  • git switch -c <BRANCH>:create and move to in 1 step -git checkout -b <BRANCH>:the older way to create and move to branch
  • pull request: meraging a branch on the remote(i.e. Github)
    • update PR by pushing to the branch
    • merge the PR in the remote
    • delete the branch on the remote
  • quick link for for workflow: https://bi-sdal.github.io/training/help-faq.html
  • git rebase main: rebases current branch

About

Git tutorial work with Daniel Chen