Junior
What Git commands do you know?
sobes.tech AI
Answer from AI
git init- Initializes a local repository.git clone <url>- Clones a remote repository.git add <file>- Adds changes of a file to the staging area.git add .- Adds all changes to the staging area.git status- Shows the status of changes.git diff- Shows differences between working directory and staging area.git commit -m "message"- Commits changes with a message.git commit -am "message"- Adds all tracked changes and commits.git log- Shows commit history.git branch- Lists branches.git branch <branch_name>- Creates a new branch.git checkout <branch_name>- Switches to another branch.git checkout -b <new_branch>- Creates a new branch and switches to it.git merge <branch_name>- Merges the specified branch into the current one.git pull- Fetches changes from remote and merges.git push <remote> <branch>- Pushes changes to remote.git remote add origin <url>- Adds a remote repository with aliasorigin.git fetch- Fetches changes from remote without merging.git reset <file>- Unstages a file.git reset --hard <commit_hash>- Resets to a specific commit, discarding changes.git revert <commit_hash>- Creates a new commit reverting a previous one.git rebase <branch>- Reapplies commits on top of another base.git stash- Temporarily saves uncommitted changes.git stash apply- Restores last stashed changes.git tag <tag_name>- Creates a tag.git config --global user.name "Your Name"- Sets global username.git config --global user.email "your.email@example.com"- Sets global email.
These commands are fundamental for version control with Git.