--------------COMMANDS---------------
dir /a # (Windows PowerShell) List all files including hidden files
git status
git init # Initialize a new Git repository
git log # Show detailed commit history (author, date, full hash)
git log --oneline # Show commit history in short form
git log -- <filename> # Show history for a specific file
git branch
git branch <branchname>
git add . # Stage all files (respects .gitignore)
git add <filename> # Stage a specific file for commit
git commit -m "comment" # Create a snapshot (commit) with a message
git switch <branchname>
git switch -c <branchname> # will create a branch and switch to that branch
git merge <branchname>
git diff
git diff <commit1> <commit2> # Compare differences between two commits
........renaming-branch----
git switch <branch_to_rename>
git branch -m <new_name>
------------delete-branch-----------------------
git branch -d <branch-name>
git branch -D <branch-name> # force delete
------------git-restore-cmd-------------------------
git restore # remove uncommited text and restore file to last successful commit
git restore --source HEAD~2 myrestore.txt # this will go back to 2 commits of myrestore.txt
git restore --staged <filename> # this will remove file from staged area
--------------------git-reset-----------------------------------
git reset 798927a
# The command git reset 798927a moves your current branch backward in time to the specific commit 798927a, while leaving your actual code changes intact.
------------------------------------------------------------------------
.gitignore entries:
secrets.txt #file
.venv/ # directory
------------------------------------------------------------------------
echo "# Todo_App_py" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
# The -M option in git branch -M main forces Git to rename your current branch to "main," even if a branch named "main" already exists
git remote add origin https://github.com/myname/{repository_name}.git
git push -u origin main
git remote add origin https://github.com/myname/{repository_name}.git
git branch -M main
git push -u origin main
---------------------------GitHub-----------------------------------