[Git] Git Basics

less than 1 minute read

Git Basics

  • Essential commands
  • Fixing previous commit

Essential commands

  • Do not make a git repository inside a nested subfolder
# check
git status

# create a new git repository 
git init

# add to working stage
git add . # add all files
git add file1.txt file2.txt

# add to repository
git commit

# add to working stage and to repositroy in one go
git commit -a

# get history of commits
git log
git log --oneline

Fixing previous commit

  • Only available on the previous commit
  • Useful when adding a file that should have been included or fixing the commit messsage
git commit --amend

Tags:

Categories:

Updated: