What is Rebasing? Rebasing rewrites commit history by moving your branch’s commits onto the tip of another branch. It avoids merge commits for a cleaner history.
Command:git rebase <branch-name> (e.g., git rebase main applies your current branch’s commits on top of main).
Interactive Rebasing:git rebase -i <commit-hash> lets you edit, squash, or reorder commits.
Resolve Conflicts: If conflicts arise, fix them, then git rebase --continue.
6. Remote Repositories
git clone <url>: Copies a remote repo.
git remote add origin <url>: Links to a remote.
git push origin <branch-name>: Uploads changes.
git pull origin <branch-name>: Downloads updates.
7. Undoing Changes
git restore <file>: Discards unstaged changes.
git reset --soft HEAD^: Undoes last commit, keeps changes.
git revert <commit-hash>: Creates a new commit undoing a previous one.