Git Commands

·

1 min read

  • $ git --version

git version 2.35.1.windows.2

  • $ git init test-project
  • $ git config --global init.defaultBranch main
  • $ ls -al
  • $ git status
  • $ git add .
  • $ git add hello.txt
  • $ git rm --cached hello.txt
  • $ git commit -m "adding hello.txt"
  • $ git log
  • $ git branch my-feature
  • $ git branch
  • $ git branch --all
  • $ git checkout my-feature
  • $ git restore ..." to discard changes in working directory)
  • $ git log --all --oneline
  • $ git merge my-feature
  • $ git branch -d my-feature
  • $ git stash push
  • $ git stash list
  • $ git stash apply
  • $ git stash clear
  • $ git stash pop
  • $ git push
  • $ git pull