Git

File Operations

Basic commands

Show working tree status

git status

Add files to the staging area

git add <file(s)>

Remove files from working tree and staging area

git rm <file(s)>

Move or rename a file

git mv <old_file> <new_file>

Commit changes with a message

git commit -m "commit message"

Show differences between working tree and last commit

git diff

Advanced Commands

Assume a tracked file is unchanged

git update-index --assume-unchanged <file>

Restore normal behavior of tracking changes

git update-index --no-assume-unchanged <file>

Show differences between two commits

git diff <commit_id1>..<commit_id2>

Unstage a file, but keep in the working directory

git rm --cached <file_name>

On this page