git initgit clone <repo_url>git statusgit add <file>
git add .git commit -m "your message"git loggit branch <branch_name>
git checkout <branch_name>
git checkout -b <branch_name>git checkout main
git merge <branch_name>git push origin <branch_name>git pull origin <branch_name>Sometimes, when you’re working on a branch, you want to update your local branch with remote changes but keep a clean linear history.
This is where git pull --rebase is useful.
# Switch to your branch
git switch <branch_name>
# Pull latest changes from remote and rebase
git pull --rebase origin <branch_name>
git stash # Save current changes
git stash pop # Apply the stashed changes back
git stash list # See all stashed changes
git stash apply # Apply changes but keeps them in the list
git stash clear # deletes all the stash listgit remote -v # Show remote URLs
git remote add origin <repo_url> # Add a new remote
git branch -d <branch_name> # Delete local branch
git push origin --delete <branch_name> # Delete remote branch