GIT Basics

MOC Technology

Created: 2022-05-09
Tags: #fleeting


Create a new repository or initializes the directory with git.
git init

"Working Directory" which holds the actual files
"Index" is the staging area
"HEAD" points to the last commit you've made

From "Working Directory" to "Index"
git add <filename>
git add *

"Index" to "HEAD"
git commit -m "Commit Message"

For GUI Access
gitk

git add -u

# stage the changed files
git add file1.md file2.md

# take a snapshot of the staging area (anything that's been added)
git commit -m "my snapshot"

# push changes to github
git push --set-upstream origin my-branch
git update-index --assume-unchanged <file>

Doesn't work with folders so use files

Note: This solution is actually independent on .gitignore as gitignore is only for untracked files.