Git-Commands
Git-Commands
Commands 1
🌍 Remote Repositories
git remote -v # View remote connections
git remote add origin <url> # Add a new remote repo
git push -u origin <branch-name> # Push to remote (first time)
git push # Push committed changes
git pull # Pull changes from remote
🕰️ Viewing History
git log # View commit history
git log --oneline # One-line summary
git show <commit-hash> # Show details of a specific commit
🔁 Undoing Changes
git checkout -- <file> # Discard local changes in a file
git reset HEAD <file> # Unstage a file
git revert <commit-hash> # Undo a specific commit safely
git reset --hard <commit-hash> # Reset to an old commit (dangerous!)
🧹 Clean Up
git clean -f # Remove untracked files
Commands 2