cd <project-dir>
[make sure you have up-to-date repo if working with remotes]
[enables reviewing changes in remote before overwriting local with merge]
git fetch <remote-branch>
git merge
OR
[combines the above into single cmd and overwrites local dir]
git pull origin <local-branch>
git status
OR
git status -s
Stage Changes
[add all changed and new files to stage 2 ways]
git add -A
git add --all
[add all changed and new files in current working dir to stage]
git add .
[add specific file to stage]
git add <specific-file>
[add contents of a dir to stage]
git add <dir-name>
[to remove file from stage]
git restore --staged <file-name>
[to remove all files from stage]
git restore --staged .
Commit Changes
git commit -m <commit-message>
[to add and commit with single cmd for tracked files]
git commit -am <commit-message>
[to add and commit with single line cmd including untracked files in current dir]
git add . && git commit -am <commit-message>
[to amend last commit message]
git commit --amend -m <edited-message>
[to amend last commit e.g. add more modifications, edit, re-stage and commit amend]
git add <edited-file>
git commit --amend -m <edited-message>
[to undo last commit. Only use reset if haven't already pushed to remote]
git reset --soft HEAD~1
[further detail on resetting commits in #Undoing Changes]
Push Committed local Changes to Remote
[if branch is not already tracked]
git push -u origin <local-branch>
[if branch is already tracked ]
git push
[naming rule for our commit messages:
^[^-]+-[0-9]+(?:-[0-9]+)? - \S.*
e.g., RP-1000 - This is a valid commit message]
https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository