Skip to content

saadfrhan/git-commands-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Git Commands List

Table of Contents

Basic Workflow

Initialize a git repository

git init

Check the status of the repository

git status

Add files to the staging area

git add <filenames-with-spaces>
# OR
git add .

Unstage files from the staging area

git reset <filenames-with-spaces>
# OR
git reset 

Discard changes of the last commit

git reset --hard

Commit changes to the repository

git commit -m "commit message"
# use -am to add and commit in one step

Check the log of commits

git log

.gitignore

# path to a specific file
path/to/file.txt
# files with same name
file.txt
# files with a specific extension
*.txt
# all files of a specific folder in a specific path
path/to/folder/*
# folder in the root of the repository
/folder