Basic Commands
git init
: Initialize a new Git repository.
git clone <repo>
: Clone a repository into a new directory.
git add <file>
: Stage changes for commit.
git commit -m "<message>"
: Commit changes with a message.
git status
: Check the status of the working directory.
git push
: Push changes to a remote repository.
git pull
: Fetch and integrate changes from a remote repository.
Branching
git branch
: List all branches.
git checkout <branch>
: Switch to a specified branch.
git merge <branch>
: Merge a specified branch into the current branch.
Viewing History
git log
: Show the commit history.
git diff
: Show changes between commits.
Undoing Changes
git reset <file>
: Unstage a file.
git revert <commit>
: Create a new commit that undoes changes from a specified commit.