Here are some helpful git commands:
git init
: Initializes a new Git repository.
git clone <repository>
: Creates a copy of an existing repository.
git add <file>
: Stages changes for the next commit.
git commit -m "message"
: Commits staged changes with a message.
git status
: Shows the status of changes as untracked, modified, or staged.
git log
: Displays a list of recent commits.
git diff
: Shows changes between commits, commit and working tree, etc.
git branch
: Lists all branches in the repository.
git checkout <branch>
: Switches to a different branch.
git merge <branch>
: Merges changes from one branch into the current branch.
git pull
: Fetches and integrates changes from a remote repository.
git push
: Sends committed changes to a remote repository.
git remote -v
: Shows remote repositories associated with the local repository.
git fetch
: Downloads objects and refs from another repository.
git rebase <branch>
: Reapplies commits on top of another base tip.
git reset --hard <commit>
: Resets the current branch to a specific commit, discarding changes.
git rm <file>
: Removes a file from the working directory and stages the removal.
git stash
: Temporarily stores all modified tracked files.
git stash pop
: Restores the most recently stashed files.
git tag <tagname>
: Creates a tag for the current commit.