This guide covers essential Git commands and SSH setup for version control and remote repository management.
git config --global user.name 'UserName'
git config --global user.email 'temp@gmail.com'git config --listssh-keygen -t rsa -b 4096 -C "temp@gmail.com"eval "$(ssh-agent -s)"For Windows:
ssh-add ~/.ssh/id_rsaFor Mac:
ssh-add --apple-use-keychain ~/.ssh/id_rsacat ~/.ssh/id_rsa.pubgit remote add origin git@github.com:UserName/my-notes.gitgit remote -vgit remote set-url origin git@github.com:UserName/my-notes.gitgit statusgit add file.js # Add specific file
git add *.txt # Add all .txt files
git add . # Add all files
git add -A # Add all changesgit mv name.js newName.jsgit rm --cached my-password.txt # Remove from Git but keep locally
git reset my-passwords.txt # Unstage filegit resetgit commit -m "add a new task"
git commit --amend -m 'new text' # Amend last commitgit log
git log -n 2
git log --since=2.weeks
git log --author='UserName'git stash
git stash save 'my-comment'
git stash list
git stash pop
git stash apply stash@{56f4530}
git stash drop stash@{56d4530}
git stash cleargit push
git push -u origin maingit branch -M maingit branch -a # All branches
git branch # Local branches
git branch -r # Remote branchesgit switch -c page-header
git switch branch_namegit fetch
git pull origin footergit switch main
git pull origin main
git merge page-header
git push origin maingit branch -d page-header # Delete merged branch
git branch -D page-header # Force delete unmerged branch
git push origin --delete footer # Delete remote branchRemember to use these commands carefully, especially those that delete or modify branches and commits.