Skip to content

Latest commit

 

History

History
43 lines (37 loc) · 1.15 KB

3-version-control-with-git.md

File metadata and controls

43 lines (37 loc) · 1.15 KB

3 - Version Control with Git

Commands

  • git clone (create local copy of remote repo)
  • git add
  • git commit
  • git log
  • git push
  • git pull
  • git init
  • git remote add origin <remote_repo>
  • git push - -set-upstream origin master (create local git repo and connect to remote repo)
  • git checkout
  • git checkout -b (create new branch locally)
  • git branch
  • git status
  • git branch -d
  • git rebase(avoid unnecessary merge commits in git history)
  • git rm -r - -cached
  • git rm - -cached (remove file from remote repo)
  • git stash
  • git stash pop(save unfinished changes)
  • git reset - -hard HEAD~1(revert & discard changes to commit, ~)
  • git reset HEAD~1(revert & keep changes)
  • git commit - -amend(merge changes into last commit)
  • git reset - -hard HEAD~1
  • git push - -force
  • git revert <commit_hash>(creates new commit to revert old commit changes)
  • git merge

Remove Git

remove local .git file (contains config for git remotes etc) rm -fr .git

best practices

1 branch per feature dev branch: intermediary master branch pull/merge requests delete branch when merged add .gitignore file