Skip to content

Latest commit

 

History

History
22 lines (22 loc) · 1.55 KB

git-cheatsheet.md

File metadata and controls

22 lines (22 loc) · 1.55 KB
  • git ini: create empty local repository
  • git status: check status
  • git add : changes files onto git -> it adds and deletes if commanded -> ready to be committed
  • git commit -m "Message" (i.e. Changes on xy) -> saves changes in repository
  • git add . : add all changes
  • git restore --staged : delete added but not committed changes
  • git diff : shows changes made in the file
  • git restore : deletes all uncommitted changes
  • git remote add origin
  • git push -u origin main
  • git clone : clones repository that is not already on local drive ("first timer")
  • git push (don't need to use git remote again)
  • git log: shows git history with changes e.a.
  • git switch -c : creates new branch with
  • git switch : switch between branches
  • git pull: pulls changes that happend on the branches onto local drive (that should be done frequently on a daily basis if working on branches)
  • git branch: shows all branches <add -a> to get all branches shown (- git checkout head-1 : jumps back to the last commit before HEAD)
  • git config --global core.editor "nano" : changes default editor from vi to nano
  • git checkout HEAD~1<oder ~2/~3> -- : restores deleted file that was part of commit of head minus one session
  • history <-E> : shows used commands in terminal; add -E and you get date and time also shown
  • git branch --delete : deletes local branch // <alternative: git branch -D >